1

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.com

Can anyone point me to a guide to do this or is there a quick terminal shell command I just can copy paste in root?

0

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.

  1. To set up the logical volume using LVM see https://wiki.ubuntu.com/Lvm.

  2. Format the logical volume with the desired file system.

  3. Move the existing data to the new file system.

  4. To mount the volume at the desired location upon boot see https://help.ubuntu.com/community/Fstab.

Btrfs

Some file systems support multiple underlying volumes natively. Btrfs is one of them and available in Ubuntu out of the box.

  1. Shrink sda4 as needed and create a new partition in the newly freed space. Lets say the new partition is sda6.

  2. Format sdb1 as a new, empty Btrfs file system and mount it:

    mkfs.btrfs /dev/sdb1
    mkdir /mnt/trexample.com
    mount -t btrfs /dev/sdb1 /mnt/trexample.com
    
  3. Add the other volume(s) to the file systems:

    btrfs device add /dev/sda6 /mnt/trexample.com
    
  4. Move the existing data to the new file system.

  5. To mount the volume at the desired location upon boot see https://help.ubuntu.com/community/Fstab.

  • looks like my second hard drive /dev/sdb1 0% has stuff in it /dev/sdb1 2 816 556.64 MB 72.98 MB 2 673 388.23 MB 0% can I screw it up If I format it, can I just tell my Dedicated server hosts to do this or as someone who pays rent fo that server I am suposed to do this – Gerag2 Apr 21 '18 at 3:50
  • @Gerag2: Could you please edit your question when you want to add information? Especially file or program output listings (with the help of the {} button in the editor toolbar) will be much more readable there; alternatively you can use a pastie service for longer listings and include the link of your pastie in your question. Overall it’s best to have everything relevant in one place. Additionally, comments may be deleted for various reasons. Thanks. – David Foerster Apr 21 '18 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.