Monday, July 26, 2010

Using rsync to make a backup - Linux

Suppose you have a directory called source, and you want to back it up into the directory destination. To accomplish that, you'd use:
rsync -a source/ destination/

This command is equivalent to:
cp -a source/. destination/

except that it's much more efficient if there are only a few differences.

Just to whet your appetite, here's a way to do the same thing as in the example above, but with destination on a remote machine, over a secure shell:
rsync -v -e ssh source/

-v, --verbose

    Display the names of files transferred and statistics related to the transfer.
-e shell

    Use shell (which can be a complete command with arguments, enclosed in quotes) to create the connection between two systems for file transfer.

No comments:

Post a Comment