Palladini's picture

I have 4 Hard Dives plus a 500 GB SSD in my box I am running Turnky NAS on.  the Program does not recognize my 4 4TB SAS Drives I have hooked to the SATA Ports on my MB.

How do I add those drives to the system, either as one big pool, or in a raid configuration.

Jeremy Davis's picture

Assuming that I'm right and you're using the TurnKey Fileserver appliance, then by default what you are seeing is expected behaviour. When installed to bare metal, TurnKey defaults to just using the boot drive.

If I recall correctly, you should be able to format and configure the additional drives within Webmin. But personally, I prefer the commandline. Having said that, rather than physically using the terminal on your fileserver, I suggest using SSH (I recommend PuTTY if you're on Windows; on Linux and Mac just use the built in command).

IMO the best way to have a big storage pool in Linux is via LVM (Logical Volume Manager). I won't go into details here, but essentially LVMs are a way to abstract the physical storage from the OS. With LVM there are 3 levels; PVs (physical volumes - usually complete disks, but can be individual partitions), VGs (volume groups, groups of PVs) and LVs (logical volumes - what the OS uses as it would a normal disk).

So I'll assume that you installed to a LVM when you installed from the ISO (it's the default option). So you should already have a VG called "turnkey". To double check, you can view the current PVs, VGs and LVs with the respective commands; "pvdisplay", "vgdisplay" and "lvdisplay". Here's the output from a VM I have installed (as you can see it has a 8GB vHDD):

Checking the current LVM set up

First check the PVs with "pvdisplay":

  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               turnkey
  PV Size               

So I have 1 PV (/dev/sda) which is a part of the "turnkey" VG. We don't really need to know the info that "vgdisplay" will show, but let's have a look anyway:

  --- Volume group ---
  VG Name               turnkey
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               

Note the line that shows the free space ("Free PE / Size") - I actually have 824.00MB free. Again I won't go into detail, but that space is reserved by default for snapshots. If you're not using that functionality, then you can use all the space if you want...

Also out of interest, I'll check the LVs I have with "lvdisplay":

  --- Logical volume ---
  LV Path                /dev/turnkey/root
  LV Name                root
  VG Name                turnkey
  LV UUID                2zGtAW-i3db-3N5K-ya0S-xJGL-1pOc-n6SSby
  LV Write Access        read/write
  LV Creation host, time wordpress, 2020-04-06 04:20:19 +0000
  LV Status              available
  # open                 1
  LV Size                

So in my "turnkey" VG I have 2 LVs; "root" (the OS) and "swap_1" (my swap volume, more-or-less virtual memory aka pagefile).

Checking the currently connected disks/volumes

First let's double check what disks TurnKey can see. To list all the disk-like devices that the system can see, use:

fdisk -l

I only have one (virtual) physical disk (/dev/sda), but here's what it looks like:

Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Disk model: QEMU HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x13bf7d36

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 16775167 16773120   8G 8e Linux LVM

Disk /dev/mapper/turnkey-root: 6.2 GiB, 6652166144 bytes, 12992512 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/turnkey-swap_1: 1020 MiB, 1069547520 bytes, 2088960 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

It's showing both the "real" disk (/dev/sda), plus the LVs. Looks for the ones that start with "/dev/sdX" (see above that mine is /dev/sda). I'll assume that the other 4 disks you have are listed as /dev/sdb, /dev/sdc, /dev/sdd and /dev/sde.

Adding the HDDs and setting up a new VG and LV

You could add the 4 HDDs to the existing VG and then create a new LV if you wished, but let's keep the SSD and the older style "spinney" drives separate. We can do that by making a new "hdd" VG (I'm calling mine "hdd", but you can call it something different if you want) by pooling the 4 x 4TB HDDs together. Then I'll create a single volume to use as storage, which I'll call "storage".

Add all 4 of these disks to as PVs and add them to a new "hdd" VG:

pvcreate /dev/sdb /dev/sdc /dev/sdd /dev/sde
vgcreate hdd /dev/sdb /dev/sdc /dev/sdd /dev/sde

Now assuming that you don't want to use the snapshots feature of LVM (if you do, please have a read up on how that works...) you can create a new LV called "storage" and use the whole volume group (i.e. 100% of the 16TB; if you want smaller, either use a different percentage, or instead use the '-L' switch with a specific size):

lvcreate -l 100% -n storage hdd

Assuming that all goes successfully, you can now view your new volume like this:

lvdisplay hdd/storage

Format and set up the new LV

So now format the new volume:

mkfs.ext4 /dev/hdd/storage

I'm going to mount it to /srv/storage (the default storage location of the Samba shares on the fileserver appliance). To make sure that it's added at boot time, I'll include it in the fstab file:

echo "/dev/hdd/storage    /srv/storage/    ext4    errors=remount-ro    0    1" >> /etc/fstab

Mount the new LV and final check

And finally to mount it and check that it's mounted:

mount -a
mount | grep /dev/hdd

That should return something like this:

/dev/hdd/storage on /srv/storage/ type ext4 (rw,relatime,errors=remount-ro)

Assuming so, you should now be all good to go! :)

Add new comment