Find the answer to your Linux question:
Results 1 to 4 of 4
Hi peeps I am a basic Linux user, maintaining our in-house web servers, however this is foreign territory to me... I have added a new 2TB drive to our server, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2011
    Posts
    3

    Help needed mounting new drive


    Hi peeps

    I am a basic Linux user, maintaining our in-house web servers, however this is foreign territory to me...

    I have added a new 2TB drive to our server, showing as SD1. I want to use half of this drive to hold the existing contents of /var/www/vhosts (Plesk vhosts folder), and create a new directory in the other partition called /backup.

    I have managed to partition the drive, but i'm stuck on how to mount it as /var/www/vhosts. Do I need to move the existing contents on this location first, or after? What commands should I run to do this and mount the path? Presumably once this is done, the path /var/www/vhosts will still be valid?

    There is a Plesk command (transvhosts.pl) to move the contents of var/www/vhosts, but I think this is if you want to change the location, rather than just the mount point. Any clarifaction greatly appreciated.

    Thanks so much
    Ross

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    I have added a new 2TB drive to our server, showing as SD1
    Are you sure about that? Linux drive/partition naming is as follows: sda=first drive; sdb=second drive, sda1=first drive, first partition. Is the above a typo and you meant sdd1? That would be the first partition on the fourth drive. Clarify the number of drives/partitions.

    Is your /var/www/vhosts currently on a partition of its own or is it in the / (root) partition of your filesystem? This would be necessary information for someone to be able to assist you. If you want a partition for vhosts and backup, you would need to first create the two partitions (done already??) and filesystems on each then proceed to copy the vhosts data to the new partition. You would need to change an entry in /etc/fstab file IF you currently have the vhosts on a separate partition and are moving it to a new one.

    Post some partition information and also, are you using LVM?

  3. #3
    Linux User
    Join Date
    Dec 2011
    Location
    Turtle Island West
    Posts
    363
    You're getting into grotty territory. It's pretty easy to bugger something up badly. But I'll show you how I'd do it:

    Log in as root.

    Code:
    cfdisk /dev/sdX
    where X is whatever drive (a/b/c/d/etc)
    to create /dev/sdX1 and /dev/sdX2, make them type 83(linux) and write the partition table to disk.

    Code:
    mkfs.ext3 /dev/sdX1
    mkfs.ext3 /dev/sdX2
    
    e2label "vhosts" /dev/sdX1
    e2label "backup" /dev/sdX2
    
    mkdir /mnt/sdX1
    mkdir /mnt/sdX2
    
    mount -t ext3 /dev/sdX1 /mnt/sdX1
    mount -t ext3 /dev/sdX2 /mnt/sdX2
    
    cp -Rpv /var/www/vhosts/* /mnt/sdX1
    cp -Rpv /wherever/backup/* /mnt/sdX2
    
    mv -v /var/www/vhosts /var/www/vhosts.old
    ln -s /mnt/sdX1 /var/www/vhosts
    
    mv -v /wherever/backup /wherever/backup.old
    ln -s /mnt/sdX2 /wherever/backup
    Now you still have the old data in case something didn't work properly.

    Edit /etc/fstab and add the lines:
    Code:
    /dev/sdX1 /mnt/sdX1 ext3 auto,rw,exec 1 2
    /dev/sdX1 /mnt/sdX1 ext3 auto,rw,exec 1 2
    so they'll mount automatically at boot.

    And now you should have the new partitions mounted and linked to the correct locations. After you prove that it all works like it should, you can delete the original data.

    Good luck, and be careful.

  4. #4
    Just Joined!
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    30
    Ross,

    I think it's best to use LVM so as to avoid this situation cropping up again in the future where you'll repeat this process when your data outgrows the 2TB drive. With LVM, you simply add physical volumes and extended the logical volumes then resize the ext3/4 file system...

    My $0.02,
    ak.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •