Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been googling this topic, but there no good suggestions on how to transfer files from old Linux new server.

My goals are:

  1. Transfer all files, including hidden files

  2. Preserve permissions

  3. Preserve ownerships

  4. Preserve symlinks

  5. Ability to start transfer several times, without recopying already transfered files

Thank You

share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

You can use rsync or tar. With rsync, you want archive mode to preserve everything. You also will want to exclude the sys and proc filesystems.

rsync -av --progress / root@otherserver:/ --exclude='/proc' --exclude='/sys'

Use the dry run option (-n) first to make sure those excludes are right.

Update:
You want just the home partition, so:

sudo rsync -av /home/ root@remoteServer:/home/
share|improve this answer
    
Also would want to exclude /dev , maybe /tmp /var/run ..what else? –  Kyle Brandt Nov 3 '09 at 13:37
    
this seams perfect, I only need to sync /home –  Daniil Harik Nov 3 '09 at 13:46
    
Oh, somehow I thought I read you wanted the whole root parition:-) –  Kyle Brandt Nov 3 '09 at 13:49
    
Thank You very much! –  Daniil Harik Nov 3 '09 at 13:54
add comment

You want to use rsync. It'll do everything you want, and then some.

share|improve this answer
add comment

Just for the sake of variety, how about dd?

This doesn't fit your requirements but someone might find it useful...

For copying from the /dev/sda3 partition on the local machine to new_partition on destination_host

dd if=/dev/sda3 of=- bs=1024k | ssh user@destination_host dd if=- of=/dev/new_partition bs=1024k

Or, flipped-up-turned-upside-down (from remote to local):

ssh user@destination_host 'dd if=/dev/sda3 of- bs=1024k' | dd if=- of=/dev/new_partition bs=1024k

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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