Rsync backup with Vista10/29/2008 Charles Roth Introduction: the problem
- I want to do rsync style backups from Windows PCs, to my linux server, and do it with a minimum of hassle. (E.g. from my wife's laptop.)
- Previously (under Windows XP), I messed about with Cygwin, but it's a huge pain to get Cygwin working under <sigh/> Windows Vista.
- There's an interesting-looking tool called "DeltaCopy", that is supposed to be a user-friendly wrapper around rsync. While it appears to work nicely when backing-up a Windows client to another Windows server, I could not convince it to talk rsync/ssh to my linux server.
Looking under the hood of DeltaCopy, I found that it already contains all the key parts of Cygwin needed to do rsync vis ssh -- no additional Cygwin install is needed. So some very simple hacking, and one batch file, are all that is needed to get rsync backup working.
- Download and install DeltaCopy. Do not enable the DeltaCopy server, we're only going to use pieces of the client. (We won't actually use the provided DeltaCopy client, either.)
- Create keys. On the linux server, create a new key with ssh-keygen. Just type "ssh-keygen", and press Enter at all the prompts. (In particular, you must use an "empty" passphrase.)
- Copy keys to DeltaCopy folder. From the linux server, copy .ssh/id_rsa to C:\Program Files\Synametrics Technologies\DeltaCopy\sshkey. Similarly, copy .ssh/id_rsa.pub to C:\Program Files\Synametrics Technologies\DeltaCopy\sshkey.pub.
- Copy public key to linux userid. Copy the id_rsa.pub key to .ssh/authorized_keys in the target userid on the (to-be-backed-up-to) linux server. Make sure that .ssh has "700" permission.
- Create backup batch file. The backup will be performed by a Windows batch file, that needs no user interaction (other than to start it). The specifics depend on exactly what is being backed-up where. For example, suppose I wish to backup the Windows Vista user jdoe's Documents directory, to the userid "backupjdoe" on the linux server myhost.com. I would create a batch file, e.g. "backup.bat", that looks like:cd \Program Files\Synametrics Technologies\DeltaCopy rsync -avz -e "ssh -i sshkey" /cygdrive/c/Users/jdoe/Documents firstname.lastname@example.org:.
- Run as Administrator. Depending on exactly what you are backing-up, you may find it necessary to run the batch file with full Administrator rights. To do so:
- Create a shortcut from the batch file, onto the desktop.
- Right-click on the shortcut.
- Select "Advanced".
- Check "Run as Administrator".
- Scheduling automatic backups. More to come on this one...
Ola Lindberg notes:I used to run Rsync on my WinXP box but since I moved to Vista I had some problems using it (for example international chars would fail) so I looked around and found Robocopy. If you are running into Rsync-Vista problems and you can set up your computers to copy to a file share (smb) instead of via ssh I think robocopy would work fine for you as well. I use the following to copy my files with Robocopy: robocopy source destination /MIR