Rsync examples

cmd    flags            remote server               local server
rsync -avHe ssh –progress root@oldip:/home/user/mail/ /home/user/mail/
rsync -avHe ssh –progress root@oldip:/home/user/etc/ /home/user/etc/

Safe way to copy files

Source directory: /mnt/nfs/contents
Destination directory: /home/user1/public_html
Log files location: /home/user1/logs/copy.txt

check the total number of files in the source directory:
$ tree /mnt/nfs/contents/ | wc -l

run the command:
$ rsync -Pavzh --log-file=/home/user1/logs/copy.txt /mnt/nfs/contents /home/user1/public_html &

Check the progress:

$ tail -f /home/user1/logs/copy.txt

Count the total number of files in the destination directory:
$ tree /home/user1/public_html/contents/ | wc -l

If the copy process being interrupted, you just need repeat step 2 and the copying process will continue from the last state before interruption.


I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.