
Using cwRsync on Windows and rsync on Linux you can seamlessly mirror directories on two or more computers. In my case, because of iTunes and an iPod, I’m forced to keep a copy of my library on a desktop computer and on my media server. Yes, I’m aware of mt-daapd and I already have it working; unfortunately that’s not a solution in this case.
What you’ll need:
- cwRsync, download and install on your Windows computer.
- rsync, install and make sure it’s running on your linux box
- Open a command prompt Start -> Run -> cmd
- Add cwRsync to your windows ‘path’ so that you can run it. Just type this at the command line:
path = %PATH%;c:\program files\cwRsync\bin - Create the Key
ssh-keygen -f /cygdrive/c/ssh_key -t rsa -N ''(please note; this creates your keys in the C: directory) - Copy your public key to the server:
rsync -e ssh /cygdrive/c/ssh_key.pub username@serverAddress:~/.ssh/authorized_keysYou’ll need to enter your username and password - Copy your public key into your ssh authorized_keys file:
ssh username@serverAddress cat ssh_key.pub >> .ssh/authorized_keys - Test your backup:
rsync -avz -e "ssh -i /cygdrive/c/ssh_key" "Desktop" username@serverAddress:folderNameThis should copy everything on your desktop to the directory named folderName on the server - Download and edit the sample batch file
- Once you’ve edited the sample batch file store it temporarily in the C: directory and run the batch file manually
c:\data-backup.bat - Set your batch file to run automatically: Go to Start -> Control Panel -> Scheduled Tasks and click ‘Add a Scheduled Task’. Next -> Browse. Set the schedule and enter your account password to allow the software to run.
I’m successfully using the sample batch file to mirror a music directory on my media server with a desktop computer.
While music is the subject of our conversation; give Chris And The Other Girls a listen. They’re less popular than they deserve to be. I particularly like track 01 Let Go, download it here.
Okay, looks like there’s a freely available open source, GUI wrapper for rsync. Give it a try and let me know what you think. Download and documentation can be found here
[...] In Tech explains how to do the same on Windows with cwRsync (a package of Rsync and [...]
[...] In Tech explains how to do the same on Windows with cwRsync (a package of Rsync and [...]
Hey, very nice article!
You skipped a VERY key step, makes the directions impossible to perform as is.
Windows does not have SCP and you don’t include any clue where this comes from.
Thanks Alvin, I didn’t want to write over any authorized key files one might already have in the .ssh directory on the server. I’ve updated this how-to. Now your “ssh_key.pub” should be copied over to the server as “authorized_keys” in the .ssh directory.
Please let me know if you have any other problems.
[...] E se alguén quere facer a proba desde o windows, que bote unha ollada acó. [...]
This is awesome. Thanks for sharing.
Step 5 is redundant though. You just need step 4.
Also if you are running Windows Server or something you have to be careful of the Program files directory in the batch file:
SET CWRSYNCHOME=C:\Program Files (x86)\cwRsync\
Nice tut, thanks!
IMPORTANT to know that in the Batch example file if you are running it from scheduled task you should change home directory from
SET HOME=%HOMEDRIVE%%HOMEPATH%
to
SET HOME TO %USERPROFILE%
in order to point to the correct path.
correction:
SET HOME=%USERPROFILE%