Adding Linux Drives

Add Drive to server (either physically or virtually)
Run the below command to list all available drives and partitions (-f specifies format of drives (xfs/ext4/btrfs etc..)
Take note of the device path of new drive for rest of setup

lsblk -f

Next you need to format the drive in your desired format (xfs/ext4/btrfs etc..)
The below command will format the drive in xfs (/dev/sda is just and example)

sudo mkfs.xfs /dev/sda

Create a mount point (Replace MountPointName with whatever you wish) and then mount the drive to the mount point

sudo mkdir /mnt/MountPointName
mount /dev/sda /mnt/MountPointName

Once that is all working and you are happy then we need to set up some persistence for the drive to be available on boot.
In order to do that we must edit the /etc/fstab file

sudo nano /etc/fstab

Add the below entry for it to load these mount points on boot to the file system

/dev/sda      /MountPointName   xfs   defaults   0   0

Sometimes I find that the device path changes or has been changed.
You can find the UUID of all your attached drives with the below command and then map it that way which is consistent because the UUID is specific to that drive

sudo blkid | grep UUID=

Your FSTAB file would then look like the below

UUID=xxxxxxxxxxxxxxxx      /MountPointName   xfs   defaults   0   0

Leave a Reply

Your email address will not be published. Required fields are marked *