Howto move /var/www other HDD ?

Discussion in 'Installation/Configuration' started by Herbert, Nov 23, 2006.

  1. Herbert

    Herbert New Member

    My partition on /var/www is 20gig: ext3 /dev/sda2
    I want to move all websites to a new disk 80gig: ext3 /dev/sdb1
    ext3 /dev/sdb1 is now mounted as /backup
    I have in fstab:
    LABEL=/backup /backup ext3 suid,dev,exec 0 2
    LABEL=/var /var ext3 grpquota,suid,dev,usrquota,exec 0 2
    and mtab:
    /dev/sda2 /var ext3 rw,grpquota,usrquota 0 0
    ext3 /dev/sdb1 must be /var/www
    Can i simple edit mtab and fstab and reboot?
    What i have to do?
  2. sjau

    sjau Local Meanie Moderator

    what I did is the following:

    mv the www folder to something else:

    mv /var/www /var/www2

    Then create the new www folder

    mkdir /var/www

    and then mount the new harddrive in the /var/www folder

    and finally copy all the data back to the new location

    cp -pR /var/www2/* /var/www/
  3. Herbert

    Herbert New Member

    Thanks sjau,
    i try it this weekend..
  4. Herbert

    Herbert New Member

    Was not ok..
    My labels are wrong, i had to change LABEL=/backup to LABEL=/dev/sda2 etc..
    After that i moved with success.

  5. sjau

    sjau Local Meanie Moderator

    How did you do it now?
  6. Herbert

    Herbert New Member

    Hello sjau,
    First make a map /old
    then cp -pR /var/* /old
    umount /backup
    umount /var
    when /var is busy then force umount.
    After that edit /etc/fstab
    #old line (/backup is /dev/sdb2 and /var is /sda2)
    #LABEL=/backup /backup ext3 suid,dev,exec 0 2
    #LABEL=/var /var ext3 grpquota,suid,dev,usrquota,exec 0 2
    #new line (/backup is /dev/sda2 and /var is /sdb2)
    LABEL=/dev/sda1 /backup ext3 suid,dev,exec 0 2
    LABEL=/dev/sdb1 /var ext3 grpquota,suid,dev,usrquota,exec 0 2
    mount /backup
    mount /var
    cp -pR /old/* /var
    rm /old
    reboot, the PID files in /var killed and some service stopped.
    After reboot all service is running.
    Last edited: Dec 2, 2006
  7. sjau

    sjau Local Meanie Moderator

    :) good to know it worked... sort of what I suggested... just a bit more more comprehensive :)
  8. Herbert

    Herbert New Member

    Ok thanks :)

Share This Page