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 firstname.lastname@example.org: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" email@example.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" firstname.lastname@example.org: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 email@example.com
rsync -avz -e "ssh" /home/user/remote/dir firstname.lastname@example.org
- B. Run rsync from your other server
rsync -avz -e "ssh" email@example.com:remote/dir /folder