How to add extra hard drive as apache webspace

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?

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.

  1. To set up the logical volume using LVM see .

  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 .

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 .

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like