Restoring Files with rsync

The great thing about using rsync for backup is that restoration is a snap. Essentially, you simply reverse your backup script: Instead of copying files to your EVBackup account, you'll copy files from your EVBackup account.

If the script to backup your files looked like this (all on one line):

rsync -avz -e "ssh -i /backup/ssh_key" /local/dir user@user.evbackup.com:remote/dir

...then the command to restore files would look like this (all on one line):

sudo rsync -avz -e "ssh -i /backup/ssh_key" user@user.evbackup.com:remote/dir /local/dir

Note the use of sudo: you'll be restoring files as root so that you can write to whatever directory you need to.

Remember, help is just an email away: .

Variations on rsync Restoration

There are lots of ways to vary the restoration command:

I Lost my Private Key!

No key? No problem! Just leave out the private key argument:

sudo rsync -avz -e "ssh" user@user.evbackup.com:remote/dir /folder

You'll be asked to enter your password, but you'll still be tunneling the restoration through SSH. Of course, you can easily create a new key and upload it to the the server.

Restoring to a Different Server

One rule to remember with rsync: either the source or the destination must be local to the computer where the rsync command is run. Assuming that you can't simply go to the other computer and run the rsync command, SSH solves this problem:

A. Log into your EVBackup account and run rsync
sudo ssh -i /backup/ssh_key user@user.evbackup.com
rsync -avz -e "ssh" /home/user/remote/dir user@other.server.com
B. Run rsync from your other server
ssh user@other.server.com
rsync -avz -e "ssh" user@user.evbackup.com:remote/dir /folder