Skip to content

Ready, Set, Rsync !

January 1, 2013

Rsync is a useful command that I have seen a lot of people comment about being really good for incremental type backups for both personal and enterprise systems. So I’ve taken it on myself to get to grips with rsync and use it much more rather than use the normal copy (cp) command.

So from the manual of rsync I have learned that we can archive the permissions/links/attributes by using the -a argument, we can compress the data being transferred from source to destination by using the -z argument, I will want the parent and child folders to be copied so I will be putting recursive copying on by using -r argument, we can get the command to tell us what it is doing by adding verbosity with the -v argument and to make sure to understand the output I want to display the output as human friendly with the  -h argument. I will also use the -P argument so that I can see the progress of the files being copied too. Using these 6 main arguments copying should not be too difficult at all.

Example 1 (I would use this example if I was copying from/to the local system)

prompt> rsync -azrvhP absolute_path_of_source absolute_path_of_destination

Example 2 (I would use this example if I was copying from/to different servers)

prompt> rsync -azrvhP -e ‘ssh’  absolute_path_of_source user@hostname:/path_of_destination/

# Note in the 2nd Example that I used the argument -e to tell the local computer to run this command through ssh which I use to connect to the remote server

Not too difficult once you have tried it a few times and the beauty of using rsync is that it will do an incremental copy to the destination which means that it will check all the files you are going to copy over and will only copy them over if the source files are newer than the destination files if present.

Advertisements

From → Linux

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: