Using Microsoft SyncToy 2 with FreeNAS

You can find my FreeNAS posts/Tutorials here:

[Of course, this tutorial applies to any remote storage that is connected to as a shared drive. This is a complimentary post to FreeNAS: The Free NAS Server - About and FreeNAS Tutorial for Windows Users - Part One - Installation]

SyncToy 2 is a free utility provided by Microsoft and it runs on Vista and XP (and Windows 2008 Server). SyncToy 2 (beta) is available from Microsoft here.

Microsoft describes SyncToy 2 as:

Now there is an easier way. SyncToy, a free PowerToy for Microsoft Windows, is an easy to use, highly customizable program that helps users to do the heavy lifting involved with the copying, moving, and synchronization of different directories. Most common operations can be performed with just a few clicks of the mouse, and additional customization is available without additional complexity. SyncToy can manage multiple sets of folders at the same time; it can combine files from two folders in one case, and mimic renames and deletes in another case. Unlike other applications, SyncToy actually keeps track of renames to files and will make sure those changes get carried over to the synchronized folder.

  1. Download the file.
  2. Install SyncToySetup.exe
  3. Start the application
    1. Start Menu
    2. All Programs
    3. SyncToy 2.0
After you either allow Microsoft to gather some data about how you use SyncToy (or decline), the opening Welcome screen displays: Welcome

Your only option here is to create a folder pair. Folder pairs are the basic building blocks of SyncToy – simply put, they are the two folders you want to manage (sync). Select “Create New Folder Pair”.

2 FolderPair1 As you can see, you are shown two folder selection dialogs. For this tutorial we will sync our Music folder on our PC with the music folder on the FreeNAS server.
The first thing we do is locate our local music folder. Click on the left “Browse” button.
A standard Windows Explorer file browser opens. For this example we will sync the music folder located in on my local “F:” drive. ST1
ST2 To do that we simply drill down the folder tree until we highlight the music folder. Once selected, click “OK”
Now the left side of the sync is configured. Time to connect to the server! 6 FolderPair L
7 FolderPair R Next we select the network path to “music” on the FreeNAS Server.In this example, I typed in the UNC path. If you have mapped a network drive, you can browse and select it (see next image).
This is an example of browsing to a mapped network drive. 8 FolderPair R
9 FolderPair R So now we have our local Music Folder linked to the shared music folder on FreeNAS.
Now you have a choice to make. This requires some more explanation (or you can just click on the link for “More Information” 10 FolderPair R

You have three options here, and it is important that you understand them.

1. Synchronize – changes on either side are reflected on the other. If you delete a file on your FreeNAS server, it is deleted from your local machine. The same thing goes for renaming files, adding files, etc. This is the most common use.

2. Echo – This basically sets the left folder (on your local machine) as the “Master”. Changes you make on your FreeNAS server are NOT reflected on your local drive.

3. Similar to Echo, but deletions on either the server or the local drive do NOT delete files in the other folder. New files added to the local folder are copied to the FreeNAS server, but additions added to the FreeNAS server are NOT copied to the local folder.

For my Music, I want everything I do on my local machine to be reflected on my server. If I add a new song, rename a song, delete a song, etc I want the server to reflect that. Basically I am using FreeNAS to make a duplicate of my local Music Folder.

synch 1 So I selected Echo and am now asked to name my pair – I’ll call it “Music” because I am creative that way.Type in the name of your pair and click on Finish.
Now we can see the Folder Pairs I have configured. You’ll see “Music” is selected. Now I can click on “Preview” to see what is going to happen BEFORE I actually make any physical changes to my data. STS1
sts2 You can see that my ZZ Top music will be copied from my local drive to my shared drive on the FreeNAS server. Cool – I can see that nothing is going to be deleted (look at the “Preview Results” box at the lower left).
Now we do an actual sync by running the Folder Pair. The results show that all nine files were correctly copied to the server. st10
st11 Here you can see that I have created multiple Folder Pairs for my desktop, movies, music, pictures and video folders.In the next section we will set Windows up to execute these Folder Pair Syncs every night, without user intervention.

Automation – Vista (For XP see below)

We are going to use the built in Windows Task Scheduler program to automate our SyncToy session.

Task Scheduler is locate in the Start menu under Accessories|System Tools – go ahead and run it.

TS1 Task Scheduler on Windows Vista. I’ll cover XP further down.
Click on the “Create Basic Task action (as highlighted in the previous image).You will be presented with a dialog box. The first thing we’ll do is name this Scheduled Task “SyncToy Run” and give it a description. ts2
ts3 After clicking on Next the dialog presents the “Trigger” portion of the setup. I want this task to run daily, so I am not making any changes here.
The next screen allows us to specify the time of day the task runs. I want mine to run at 3 am – that way it will be finished before I wake up in the morning. Just choose a time when your computers are turned on, and hopefully not being heavily used. ts4
ts5 On the action screen we want to start a program.Make sure it is selected and click next.
Ok, now comes a little bit of work (just a little!).Click on the Browse button and navigate to your Program Files folder (normally “c:\program files”)Drill down the folder list until you find the SyncToy 2.0 Beta folder and open it. ts6
ts7 Highlight the file “SyncToyCmd”. This is the SyncToy command line executable. It lets us run the Folder Pairs without user intervention.Click on Open.
In the “Add arguments” text box type “-R” (without the quotes. This tells SyncToy to run all Folder Pairs marked as active.The Start in” box stays blank. Click Next. ts8
ts9 The final settings are displayed. Review them and click on Finish.
Back on the main screen for Task Scheduler you can click on the “Task Scheduler Library” link on the left, select “SyncToy Run” from the available tasks, then click on “Run” on the right. This will allow you to check that the Task actually runs correctly. ts10
cmd1 While the task is running a command window will open, as shown here. Depending on a lot of factors (speed of your network, speed of computers, speed of hard drives, etc) this could take hours to run – especially the first time you Sync. Subsequent runs will be much faster since only new or modified data will be copied.

Close the Task Scheduler. That’s it – you are finished. Your data is now automatically synchronized with your server every morning.

Read on only for information on adding the task to XP.

Automation – XP

Setting up a Scheduled Task in XP is similar to Vista. The Task Scheduler in Vista is a newer and more powerful version, but for our purposes the XP version is just fine.

Launch the Scheduled Tasks utility by going to Start|All Programs|Accessories|System Tools.

xp1 Although the dialog box looks different in XP, the setup is actually quite similar to Vista. Double-Click on the “Add Scheduled Task” link.
The Scheduled Task Wizard pops up. Click on Next. xp2
xp3 Click on the Browse button and locate your SyncToy 2.0 Beta Folder (under Program Files, usually in c:\program files”).
Double click on the SyncToyCmd file and click “Open”. xp4
xp5 Type in a name (SyncToy Run) and select Daily, then click on Next.
Set the time for the task to run (3:00 am), choose Every Day and click Next. xp6
xp7 On XP you have to enter a valid user account and password. Enter this information (your Window login name and password) and click next.
Click on Finish. xp8
xp10 Right-Click on the Task and Select “Properties” from the menu
We are going to manually edit the “Run” line. All we are going to do is add a -R to the end of the existing line.The existing line ends with “…\SyncToyCmd.exe” and we want it to end with “…\SyncToyCmd.exe -R”So make that change. xp11
xp12 Click Apply to save your changes. If you are prompted for your password again, enter it.Now you are set up to automatically run the Folder Pairs on your XP box.
You can test it by Right-Clinking on the task and selecting Run from the popup menu. xp13

That’s it. If you have any questions, you can leave them in the comments.

Comments

  1. @Josh – That’s fine with me. Share away! Glad it helped.

    Rob

  2. Hey there, Great info, I had just started experimenting with freeNAS and I had been on the hunt for some new tricks and this is a great one, just what I needed. You mind if I post a referral link to this and a couple other articles about freeNAS on my blog? Not copying your post, but a small link to it for my tiny amount of followers to get some good info?

    Josh

  3. WilliamL says:

    When using the -R switch to sync, and I have multiple folders to sync, are there any issues with some of the folder names having spaces? Some do and some don’t. If there is an issue they how would one get around it without renaming the folders?

  4. Hi! I will like to know what type of services I will need to be running on my NAS in order to work with synctoy2. I am running freeNAS and a windows xp machine. I use Samba services to connect the boxes.

    I tried the Rsync route but running into problems and will like to give your tutorial a try.

  5. Rob is it possible to add the command quiet after the -R to have it run in the background?

    Thanks

    Eric

  6. @Mamat – please feel free to translate it. And your English was perfect!

    Love that you find it useful.

    Rob

  7. Hi.. i’m Mamat from Indonesia,..

    This tutorial is great.. thank’s for sharing..

    Can i translate your tutorial (Using Microsoft SyncToy 2 with FreeNAS) to Indonesian language ?? i want to put it on my blog..
    pls let me know if I could do that… thank’s

    sorry for my poor english..

  8. Paul Martin says:

    I am wanting to push the log file from SyncToycmd.exe to a specified location to enable users to see their own log file. Can you please tell me how to do this.

    Thanks

  9. Heather G says:

    Thanks so much for your help with this.

    I think I’ve gotten this to run as scheduled by doing the following:
    Deleted the scheduled SyncToy task.
    Went to: Control Panel – Administrative Tools – Services. Found Task Scheduler & Restarted Services.
    Restarted pc.
    Added SyncToy to tasks again.

    This time the backup worked as it should, with the exception of it running all folder pairs, instead of just the one specified. I’ve tried every combination possible with the -R switch, but Scheduled Tasks can’t seem to differentiate on my system. But, at least I no longer need to manually do a nightly backup.

    I will definitely keep an eye out for your next tutorial (Currently I have a SimpleShare NAS, but I’m always looking for an easier route to maintain my home network).

    Thanks again!

  10. @Heather – I just tested it on a couple of XP systems and it ran fine on one, and didn’t run on the other. On the machine where it would not work I changed the Scheduled Tasks command line from “…/synchtoycmd.exe -R” to move the -R OUTSIDE of the quotes.

    I really have no idea if that will help you – it did work for me though.

    I am also working on a new tutorial on how to use the RSYNCHD part of FreeNAS with Windows. Basically it is another way of doing the same thing SyncToy does, but by having the FreeNAS server control the backup. Not sure when I will get that done, but I’m working on it.

    Rob

  11. Heather G says:

    Sorry Rob…I did not realize until just now how quickly you had responded. :)

    If I’m understanding you correctly – yes, I can start up the SyncToy GUI, select the folder pair I want, hit run, and all is well…no errors, does what it should do, and when I compare folders everything looks right. The problem seems to lie within the Scheduled Tasks.

    I’m not sure if this will make any difference, but this particular pc is running Windows XP (Media Center Edition), with SyncToy2 beta. Any other ideas?

  12. @Heather – if you run the same “paired folders” from within the GUI, does it work? It sounds like the command line version isn’t able to see and/or write to the hard drive.

  13. Heather G says:

    I have tried this over and over again, and can not get SyncToy to run as scheduled. The only difference with my setup is that my “run” line is as follows…

    “C:\Program Files\SyncToy 2.0 Beta\SyncToyCmd.exe” –R“My Docs G”

    I am trying to backup my docs to my G drive nightly, and then I have another folder pair scheduled to backup to my NAS once a week. When I choose run, a blank command window appears for a brief second, Scheduled tasks will then show that the process has run, but when checking my G Drive, nothing has been copied and SyncToy shows Last Run being the last time I physically ran the program myself.

    Any suggestions?

Trackbacks

  1. [...] SyncToy dapat digunakan untuk melakukan sinkronikasi antara 2(dua) folder/direktori atau bahkan disk. SyncToy tidak secara spesifik diperuntukkan bagi FreeNAS, namun tutorial berikut akan menjelaskan bagaimana memanfaatkan Tools ini bersama dengan FreeNAS Server. Tutorial ini adalah hasil translate dari tulisan Rob La Gesse : Using Microsoft SyncToy2 with FreeNAS [...]