Stuff to pimp your Windows Home Server

Hacking Windows Home Server is a blog dedicated to Microsoft's WHS technology. Brought to you by Donavon West, Microsoft MVP and author of LiveGadgets.net and donavon.com I'll also discuss the Hewlett-Packard HP MediaSmart Server EX470, EX475, EX485, EX487, the T7-HSA Tranquil Harmony Home Server and any other new Home Server hardware platforms that arise. You can also call this hacking or hackz. In any case I will show you some cool things to make your Microsoft Windows Home Server even sweeter.

A blog devoted to getting the most out of your
Windows Home Server by Microsoft MVP Donavon West.

Thursday, February 12, 2009

Syncing Two Windows Home Servers

Syncing Two Windows Home Servers

You have two Windows Home Servers and you want to keep the files on the folder shares synchronized (i.e. mirrored). Why would you want to do this? Maybe you're ultra paranoid about hardware failure. Maybe you just built up a new powerful DIY box (to replace an older server) and want to weed out any stabilization issues with the new machine before you do the actual cutover. Whatever the case may be, how do you go about keeping the data on the two servers synchronized?

This article will show you how to use a free application (um, toy) from Microsoft called SyncToy 2.0. I first showed you SyncToy back when talking about the Flip Mino HD, so forgive me if this article appears to repeat some of the steps outlined there.

  1. Download the SyncToy 2.0 installer onto one of your Windows Home Servers. I decided to "push" files to the other server instead of "pulling" them, but I don't think either way matters very much.
  2. Remote into your WHS. You are installing the software from the desktop of your server, not from a client PC.
  3. Run the installer and you will see a dialog asking permission to install Microsoft Sync Framework. SyncToy (the application) uses this framework to do it's stuff.
  4. After the framework installs, SyncToy the application will be installed.
  5. I won't bore you with the next 4-5 screen, but basically you can just click Next accepting the defaults. The app will then install and you click Close.
  6. With SyncToy installed, we will now setup the folder pairs that you want synchronized. A "folder pair" is just that: a pair of folders (one on the "left" and one on the "right") that you want to keep in sync.
  7. Click Start, All Programs and the on SyncToy 2.0
    image
  8. When SyncToy first runs there are no pairs setup, so click on Create New Folder Pair.
    image
  9. In my case, I am syncing data between my current server named HOMESERVER and the new one named SERVER. Clever names, huh? My goal is to have the server reflect any changes and/or new files that are on homeserver. Essentially server will become a mirror of homeserver.
  10. With that in mind, we will start with the Photos share. On the left, I type \\Homeserver\Photos and on the right \\Server\Photos and click Next.
    image
  11. Next I select Echo as the type of synchronization and click Next. Echo will keep the right computer looking just like the one on the left.
    image
  12. The last step is naming my pair. Type in something appropriate and click Finish.
    image

Repeat this procedure for each folder share that you would like to synchronize (probably all of them). Note that when syncing your Users share, you must create a separate pair for each user (e.g. \\HomeServer\Users\Donavon and not just \\HomeServer\Users).

image

At this point my pairs look like this (above). Let's see if we have things setup properly. Click on All Folder Pairs then Preview All. SyncToy will show you every action that it need to take, but in Preview mode it doesn't actually perform the actions (we'll have it do that later, while you are sleeping).

Scheduling

Once you have all of your pairs defined, we need to schedule these to run unattended and in the background. SyncToy 2.0 does not do this for you, but we can use the scheduler built into Windows 2003.

To schedule a SyncToy to run as a task:

  1. From the Start menu, select All Programs - Accessories - System Tools - Scheduled Tasks.
  2. Select Add scheduled task to start the Scheduled Task Wizard. You will see a list of possible programs to run.
  3. Select Browse and locate the SyncToyCmd.exe (in the Program Files\SyncToy 2.0 folder)
  4. The wizard will next prompt you for a name and how often you want to run the scheduled SyncToy (for example, daily, weekly, et cetera). Select a frequency (I chose Daily) and a name that makes sense, such as SyncToy.
    image
  5. The next page asks when to start the task. Select a start time.  3am seems like a good time. That should give your WHS backup time to complete. You can adjust this time if necessary.
  6. The next page asks for the user name and password to run the program under. You will likely choose teh username Administrator. Please note that you should use the same username setup on teh opposite server and use the same password in order for the folder share to work.
  7. The final page contains an option to open the properties dialog when the wizard ends. Select this checkbox.
  8. Modify the Run textbox to include the –R command line option. –R all by itself will run all folder pairs that are active for run all.
  9. When you are finished the dialog should look like this:
    image

Note: If the folder pair name contains a space, surround it with quotation marks, as the example above shows. For another example, assume that SyncToy is in the folder named C:\Program Files\SyncToy 2.0 and that you want to run a folder pair named "My folder pair." Enter the command line as follows, including the quotation marks: "C:\Program Files\SyncToy 2.0\SyncToyCmd.exe" -R "My folder pair." Note that there are two sets of quotation marks in this case: one is around the path to the SyncToy program file and the other surrounds the folder pair name.

Verifying

After you let it run overnight, the next morning you may want to verify that the sync actually worked. You can spot check a few files, but there is a better way. Remember the Preview All procedure that we ran above? The first time it yielded a list of operations to perform. If SyncToy successfully ran, there should ne no operations to perform at this point. Run SyncToy and click on All Folder Pairs then Preview All.

SyncToy also keeps a handy log file that will show you all operations performed. Click File, View Log.

Conclusion

SyncToy is a useful little utility that WHs users should be aware of. This article talked about keeping two servers in sync. But you could even use SyncToy to initially get two servers in sync (and to verify that they are in sync) before decommissioning your old server (i.e. use SyncToy as essentially a migration tool). Even if you don't need it right now, keep it in mind. I bet you will find other instances down the road where SyncToy will come in handy.

Fin. Why not comment on what you've just read or even Digg It!

Microsoft Social Bookmark on Microsoft Social

15 comments:

n_partsafas said...

Can the server be located in a remote location?

Chris Kenney said...

I was just thinking of the same question as n_partsafas. With your previous blog talking about backing up to a cloud or using the fire resistant IOSafe, why not sync with another WHS at a relatives house (and they could do the same with yours). Offsite backup without the monthly charge.

zkmusa said...

I also have quite a bit of shared storage space available. Can you set up SyncToy to back up via FTP?

Michael said...

Great write up.

If this doesn't allow sync to FTP you could try GoodSync. Though it is not freeware. I got my copy cheap as I already owned Roboform so if interested check out Roboform as well and buy both to receive a discount.

Off the top of my head GoodSync supports local machine and LAN as well as FTP, WebDAV, and Windows Mobile devices.
http://www.goodsync.com/

Troy said...

Depending on your amount of data, it could take quite some time to use an off site server.

You could also use RoboCopy which is another free tool from Microsoft and that would allow you to do this without installing anything on your server. Remember to grab the GUI for it if you're not comfortable using the command line. Specify \\OldServer\share as the source and \\NewServer\share as the target. You can also use the monitor switch to watch a target directory and copy changes out automatically if you do want to install it on the server.

greenspeed said...

Have you considered using Windows Live Sync? I find it works very well with WHS.

IamDefiler said...

I actually have a couple of clients that do off site syncing using synctoy2 and Hamachi. Works like a champ. Just use a UNC path with the Hamachi IPs.

Sandy said...

One thing to watch out for when using Echo is that it does not protect against user error. Probably a better idea to Echo during initial setup and then Contribute ever after.

bsquarewi said...

Something like this would make a great plug-in program. I would love to be able to stick another WHS over at my sisters house or something and have a number of folders "duplicate" in a Peer2Peer fashion.

It's all good and great that my 500GB of home movies are redundant on duplicate drives in my WHS, but that doesn't protect that data from a house fire. And as more and more data is added due to HD Family Video and SLR photos, the price of "The Cloud" backup becomes prohibitive.

PLEASE someone (much srter than me) write this plug-in.

xpgx1 said...

Simply put - you're awesome. This is the only Blog / the only source of interesting yet entertaining Home Server news, how-tos and other stuff. Great work with this one - I'm actually considering on becoming ultra paranoid :D Greetz from Germany

Brian said...

@Sandy - "One thing to watch out for when using Echo is that it does not protect against user error. Probably a better idea to Echo during initial setup and then Contribute ever after."

Great catch. You can also choose to have SyncToy copy overwrites to the recycle bin so there's a bit of protection, but nothing to stop deletes.

John said...

I'm having GREAT luck using the free VPN at logmein.com (hamachi) and SyncToy to sync two WHS units at two different locations. My office shares are backed up to a USB drive located on my WHS at home, and my WHS at home is backed up to my office WHS's USB drive. I've ALWAYS got an off site backup of my important files at the office, as well as an off site backup to my important personal docs.

CowboyBob said...

I read your article with great interest and have a couple of questions.

1) If I understand this correctly I only need to install SyncToy on the compuer doing the syncing. E.G. syncing Server1 to Server2 would only require installation on Server1.

2) Is there any documentation? In particular, what is the difference between Synchronize, Echo, and Contribute?

3) What is the difference between SyncToy and Sync Center on Win7 and Vista?

Adam said...

I have a large music library on a server at a friends house (FIOS) and I have it cloned on a Windows 7 machine here at my house. I set up logmein hamachi on both, then installed and setup the scheduled task for synctoy on the server to sync the music files here. The server's upload speeds are faster than mine. Works well, one thing to save you some time, kinda obvious, but, put both computers folders synced manually first, IE through USB hard drive. Then run the first sync soon after that to get a good index of both sides, so when something changes on left then it is easily seen on right without a large first sync over the internet/hamachi network. Technically synctoy works by only seeing what's changed and makes it a faster sync.

To answer the questions above:
1) Only the server doing the syncing needs the synctoy install, the other location just needs a folder.

2) Yes there is documentation within the Help for the synctoy install.

Synchronize: New and updated files are copied both ways. Renames and deletes in one folder is repeated on the other.

Echo: New and updated files are copied left to right. Renames and deletes on the left are repeated on the right.

Contribute: New and updated files are copied left to right. Renames on the left are repeated on the right. Similar to Echo, except there are no deletions.

3) Sync Center in Win Vista and 7 is mainly used for mobile device syncs I believe.

shohanali ali said...

GSCopy Pro v6.0 (RoboCopy Alternative) with Open File Agent
GSCopyPro is a single command-line tool (CLI) that can copy, replicate and move files from one folder to another. This folder can be on the same machine/ server or another server elsewhere. What makes GSCopyPro stand out from other competitors is the fact it works on 32-bit as well as 64-bit systems and has no restrictions. It can easily be scheduled to run as a scheduled task and fully automated. GSCopyPro also comes with an open file agent which can copy files that are locked/ opened by other processes. This feature is supported in all windows vSCersions from widows XP/ 2003 and later.
Go To:>> http://www.gurusquad.com/GOPYPRO

Post a Comment