Using rsync

I don't have any new information about uses of rsync. I just wanted to mention it since it is such a great tool. I mainly use it for mirroring directories and as one of my tools for DR. Here is simple example of rsync usage:


rsync -avz -e ssh --delete --exclude=some_sub_dir/ /some_dir/ 172.20.80.134:/remote_dir

This command will copy files from some_dir on your current system to the remote_dir on the remote host. It will exclude the directory some_sub_dir. You might do this if you don't need to copy on the remote host. The --delete tells rsync to remove any files on the remote host that have been removed from the source host. And the -avz are as follows:

-a will get all the file info and transfer it. This option doesn't always work. If you start getting rsysnc errors about not being able to copy permissions, you may need to ditch the a ansd copy as much inode data as you can.

-v be verbose.

-z compress the files for transfering.

And lastly you can use the -e to tell rsync what method it should use to transfer the files. You don't need this much anymore. Newer version of rsync seem to use ssh dy default. BUt older version used rcp. It never hurts to add this option of you are pusihng a script to remote hosts and don't know if rsync is up to date.

Now that you have some basics, go rsync somehting.

Comments