I have searched for this in google with no clear response
I have a webserver that is using one hard drive
/dev/sda4 40%and have a second hard drive at
/dev/sdb1 0%How would I mount or add the second hard drive to use the extra disk space in my webpage? I want to use the two hard drives at the same time.
/var/www/vhosts/trexample.comCan anyone point me to a guide to do this or is there a quick terminal shell command I just can copy paste in root?
1 Answer
It looks like you need a way to span a single file system across multiple physical volumes. I'll outline two approaches below.
LVM
You can set up a logical volume (using LVM) based on sdb1 and maybe parts of what is now sda4 and mount it at /var/www/vhosts/trexample.com.
To set up the logical volume using LVM see .
Format the logical volume with the desired file system.
Move the existing data to the new file system.
To mount the volume at the desired location upon boot see .
Btrfs
Some file systems support multiple underlying volumes natively. Btrfs is one of them and available in Ubuntu out of the box.
Shrink
sda4as needed and create a new partition in the newly freed space. Lets say the new partition issda6.Format
sdb1as a new, empty Btrfs file system and mount it:mkfs.btrfs /dev/sdb1 mkdir /mnt/trexample.com mount -t btrfs /dev/sdb1 /mnt/trexample.comAdd the other volume(s) to the file systems:
btrfs device add /dev/sda6 /mnt/trexample.comMove the existing data to the new file system.
To mount the volume at the desired location upon boot see .