how to move /var/www/ directory to another hard drive?

Discussion in 'General' started by malinens, Jul 24, 2008.

  1. malinens

    malinens New Member

    I have Ubuntu 7.10 server. I have mounted one hard disk to /var/www but this disk is almost full and I bought a new one. What should I do to safely copy files from old hard disk to new disk? New hard disk is at home but server is in data center. Can anyone give my step by step instructions to not to loose my data?

    /Sorry for my crappy English/
  2. Hans

    Hans Moderator ISPConfig Developer

    If your new drive is mounted to your Linux pc or other server, you can do the following:

    1) Login to your server via SSH with Putty.
    2) Go to the directory /var/www:
    cd /var/www

    3) Copy the content whole content to your other pc/server containing the new drive by using the secure copy command:
    scp * -r <IP-address>:/var/www/

    Note: <IP-address> is the External IP-address of your destination.
    Forward this external IP-address for port 22 (SSH) to the internal IP-address of your machine containing the new drive.
    Last edited: Sep 7, 2008
  3. Member


    I would tar the directory to somewhere with enouth space and the scp to my home server/disk and untar.

    This way you would not loose the permissions/ownerships of the files/directories.

    Assuming free space at ~root
    tar pzcf ~root/www.tgz /var/www
    scp ~root/www.tgz <myhomeuser>@<myhomeip>:
    cd <myhmeservernewdisk>
    tar zxf ~<myhomeuser>/www.tgz

    This way you'll only need, after, to unmount the disk and take it to the data centre.

    Good luck.
    Sérgio Rosa

Share This Page