Like every other website on the planet, SmallNetBuilder uses cookies. Our cookies track login status, but we only allow admins to log in anyway, so those don't apply to you. Any other cookies you pick up during your visit come from advertisers, which we don't control.
If you continue to use the site, you agree to tolerate our use of cookies. Thank you!

Router Charts

Click for Router Charts

Router Ranker

Click for Router Ranker

NAS Charts

Click for NAS Charts

NAS Ranker

Click for NAS Ranker

More Tools

Click for More Tools

NAS How To

Running rsync

Now it's finally time to do the backup. Bring up a command prompt on the client machine. The command I run to back up all my music (which should be all on one line) is:

rsync -avzr -e "ssh -i /cygdrive/c/Documents and Settings/Kevin/.ssh/open_ssh_key -p 1433" kevin@localhost:"/cygdrive/c/My Music/" "/cygdrive/c/My Music/"

So what do all the options mean?

- avrz means: Archive, Verbose, (Z)compressed, and Recursive.

- The -e flag specifies the shell to use, in this case we are telling SSH to use the OpenSSH private key (not the PuTTY .ppk one) we exported from PuTTYgen earlier.

- kevin@localhost:"/cygdrive/c/My Music/" is the source. Since I am tunneling, I use localhost as discussed earlier. If you don't have restrictions on your outgoing firewall, you can just put the hostname here.

- "/cygdrive/c/My Music/" is the destination. Because the Windows implementation of rsync is derived from Cygwin, you need to add /cygdrive/ to your path.

rsync should then start listing all your music as it synchronizes it to your client machine. The first time will obviously be quite slow, but after that it will only sync the files (and parts of them) that have changed.

Scheduling It

I run the above script every time I aquire a new album or a similar script after I have taken some new photos. But you might well want to schedule it to run daily. It does no harm, as it will download virtually nothing if nothing has changed.

If you aren't using tunneling, then really all you need to do is create a batch file and paste your version of the rsync command above, and then schedule it using Windows Scheduled Tasks which can be found in the Control Panel.

If you are using a tunnel, then things get much more complicated. You will need to load up PuTTY, wait for it to connect, run your rsync command(s), and then close PuTTY. I have created the following VBScript file to help you do this:

Option Explicit Const PUTTY = "C:\Progra~1\PuTTY\putty.exe -load saved_session" Const RSYNC = "rsync -avzr -e ""ssh -i """"/cygdrive/c/Documents And Settings/kevin/openSSH"""" -p443"" " Const RSYNC2 = "--chmod=a+rwx kevin@localhost:""/cygdrive/c/My\ Music/"" ""/cygdrive/c/My Music/"" " Const PAUSE = "ping 127.0.0.1 -n 5 -w 1000" Dim objWMIService, objWMIProcess, WshShell Dim intPID ' Start PuTTY Set objWMIService = GetObject("winmgmts://./root/cimv2:Win32_Process") objWMIService.Create PUTTY, null, null, intPID ' Wait for PuTTY to load Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run PAUSE, 1, true ' Start Rsync Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run RSYNC & RSYNC2, 1, true 'Stop PuTTY Set objWMIProcess = GetObject("winmgmts://./root/cimv2:Win32_Process.Handle='" & intPID & "'") objWMIProcess.Terminate()

Save this to a file called rsync.vbs, or anything ending in .vbs, and then schedule it to run as before.

Closing Thoughts

The script isn't great, so if you really want to automate the rsync using tunneling, I suggest you do a full Cygwin install, and use the Connect program I mentioned above.

If you are using the script, then there are three constant (Const) strings at the top of the script that you will need to edit. The first one is the location of PuTTY and the name of the session to load. The second is your rsync command. Note how the quotes in the original command have now become double quotes. The third statement is the pause to wait for PuTTY to connect. This uses ping, which in this case, will ping the localhost 5 times, waiting no more than a second for each one. You probably won't need to change this.

So there we have it, free offsite backup, what more could you ask for?

Using this method and the uplink rate of 45KB/sec from my home ADSL line, I can back up just over a gigabyte each day, should I need it. This should be enough to keep most people up-to-date.

So the next time someone asks you how much data you would lose if your house burned down, you can say "Nothing!".

More NAS

Wi-Fi System Tools
Check out our Wi-Fi System Charts, Ranker and Finder!

Support Us!

If you like what we do and want to thank us, just buy something on Amazon. We'll get a small commission on anything you buy. Thanks!

Over In The Forums

Any way to use these three combined, routing Dnscrypt through OpenVPN with Diversion hosts blocking?I've seen the article on ab-solution + OpenVPN, at...
32799 out usable for all RT-AC68U variantshttps://www.asus.com/Networking/RT-AC1900U/HelpDesk_BIOS/https://dlcdnets.asus.com/pub/ASUS/wireless/RT-AC19...
View attachment 14469 ​ Quantenna and Plume on Monday announced they are integrating Plume’s Adaptive WiFi "AI driven" mesh solution with Quantenna's...
Currently have a 100/100 Mbit connection.Looking to replace the ISP router.Was inclined for AC58U, but just saw a AC66U priced very close due to disco...
​ ASUSTOR's AS4004T is a good value in a four-bay Gigabit port NAS with a bonus 10GbE port.Read on SmallNetBuilder

Don't Miss These

  • 1
  • 2
  • 3