onedrivesynctoyheader

Using SyncToy to Sync NAS with OneDrive

SyncToy has saved the day when it comes to keeping my NAS drive up to date with OneDrive.  One of the most popular posts on this blog has been How to Sync a NAS Drive with OneDrive and since writing it and banging my head against the obvious limitations in the OneDrive client I’ve been using SyncToy for over a year now without a single issue.

Recap of Original Guide

In the original post – How to Sync a NAS Drive with OneDrive I did back in 2014, I covered the basics of what I was trying to achieve:

  • Sync N:\Data (My mapped NAS location) with OneDrive
  • Sync automatically and use real time updating, none of this task scheduler rubbish!
  • Ensure the Sync is a true two way process to capture any changes on
  • either the NAS or OneDrive
  • Costs nothing

The Home Network Topology remains the same:

OneDriveTopology
The Home Network Topology used for Syncing the NAS drive to OneDrive

I am sorry to say that despite trying several solutions for this nothing gave me exactly what I needed without some level of compromise.  Every application that was installed eventually ended up with it’s own issues.

I tried a number of alternative solutions including mapping VHD files and storing them on the NAS drive, other sync programs and even considered (only for a second mind you) looking at alternative cloud storage providers.

I finally decided to return to the objectives to see if any of them could be compromised in order to achieve a good outcome.

In the end I shortened the list down to the following two that were good candidates for compromise:

  • Sync automatically and use real time updating, none of this task scheduler rubbish!
  • Costs nothing

As much as I started to look at commercial offerings, it pained me that I’d be going to use a paid for product to make up for weaknesses in something that was free (unless you count the number of hours I’ve spent trying to fix this!).

Then I focused on the real time updating objective.  I asked myself was this something I really needed, or something that would just be nice to have.  As long as the process was automatic, I think I’d be fine.

So I took another look at the problem with this point being compromised and I took a look at SyncToy 2.1

Install and Configure SyncToy 2.1

The Setup of SyncToy was so straight forward, I see little point in covering the steps here in any amount of detail.  In summary all I did on Windows 10 was the following:

  • Download SyncToy
  • Install SyncToy
  • Setup SyncToy with a folder pair (C:\users\me\One Drive and N:\Data)
  • Run the fist Sync
  • Save the job as OneDriveSync
  • Create the following batch file:
@echo off
taskkill /f /im SyncToyCmd.exe
"C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -r OneDriveSync
exit
  • The taskkill line is introduced to kill any hung SyncToyCmd.exe processes.  I’ve witnessed SyncToy hang after completing a Sync before and this ensures any rogue processes are closed before the script runs again.
  • Setup a task schedule on the Server to run the batch file every 15 minutes
  • Pour a coffee and watch the solution just work

Summary

SyncToy 2.1 has been working flawlessly like this for over a year now and I’m very happy with the solution.  Yes it means that data can sometimes be 15 minutes old, but I haven’t yet had this issue cause me a problem.

It would be worth testing to ensure your Sync can actually complete inside the 15 minute window, the last thing you want is the script running again before a sync can complete.  If it does take longer – you will need to adjust the frequency of the scheduled task to accommodate.

I can work on N:\Data from any of my network PCs and also when away from the office on OneDrive and within a maximum of 15 minutes everything is synchronised.  You could improve this even further by reducing the timing on the scheduled task but 15 minutes is fine for my needs.

This still does not remove the issue that providing the storage was suitable, there is no real reason the OneDrive client couldn’t use a network drive as destination and completely remove the need for workarounds but for now, I’m happy.

Thank you for taking the time to read this update.  I’d love to hear how you guys are approaching this issue – feel free to share in the comments below.

21 thoughts on “Using SyncToy to Sync NAS with OneDrive”

  1. I have been trying to use a mapped drive on a Linux Server as the OneDrive location. So far, no luck, as OneDrive will not create its folder in the mapped drive. Maybe there is a Linux permission I don’t have correct, but I have tried quite a few things. You SyncToy approach would work, but my goal is to have all files on the Server and then have them backed up by an online backup provider such as iDrive or Crashplan. Any ideas?

    1. Hi Bill.

      Is there an agent you can run on the server? That’s how I would run it if the server was Windows and had local storage. I’d then share from the server so clients could access also.

    2. Mora from Snowy spring Finland

      I am going to do this also to pair my home Zyxel NSA 325 1Tb with OneDrive 1T. But one issue to solve before starting this pairing: I have in my PC only 120G hard drive, but in NAS about 250Gb used to be synced with OneDrive. To do this sync, the folder of OneDrive must be selected to be synced also with the PC, but if not selected, then SyncToy doesn’t find the source folder.

      To the point: if I choose the source folder in my NAS which is double size of the PC capacity, shall it be synced also in PC where is not enough memory for this procedure?

      1. Unfortunately yes – you will need to sync from Nas to the PC and then up to One Drive. If your drive is too small, the operation will fail and if it’s your system drive that fills up, you may run into system problems too.

        1. Mora from Snowy spring Finland

          Perhaps there is another way with this, two suggestions:

          1) In my PC I have another slower hard drive D 1Tb which does have enough memory for this. I suppose this could work out, but how?

          2) And what about if I use a Sharepoint folder instead of OneDrive folder, which is not selected to sync with OneDrive in this home PC?

          This 2) could be preferable, as then no need to waste two physical hard drives, hopefully it is possible. I shall do a test now, and then post results here.

          1. Mora from Snowy spring Finland

            Oprtion 2) works, but it’s extremely slow sync. So it is possible to use a destination folder under Sharepoint which is not syncing with OneDrive, I checked also how it works in OneDrive of iphone when outside of home wifi, and it works.

            About the batch file, did you mean Windows Command Prompt? I typed as in your batch file for command prompt, but for the second line it answers that process SyncToyCmd.exe not found.

    3. Mora from Snowy spring Finland

      There is an issue with SyncToyCmd. It only flashes open and then goes down. Tried to do that as administrator, but same result. So I cannot get into typing the batch file.

      Any ideas? My OS WIndows 7 pro and this is a laptop from work including is F-Secure Workstation security. I’ll try the same later with my own private new desktop PC wit Win 10 pro which doesn’t have this F-Secure Workstation security.

      Cheers!

  2. Does this method require having sufficient storage on your server/dedicated PC (i.e. will there be a copy on the computer running OneDrive, another copy in the NAS, and the copy in the cloud)?

    1. Yep – unfortunately because you cannot use the NAS as the OneDrive source, it will keep a copy local and sync that to the cloud.

  3. Hi Wayne, this was the post I have been looking for, but need some input 🙂

    I got SyncToy to work work fine for me, I have several mapped NAS drives that are now paired and synchronising to OneDrive. So far so good.
    Made the batch file and have it running automatically with Scheduler; also working as should.
    Now the catch: no files are synchornised when using the btach file. So checked in the log and found:

    SYNC: 03/13/2017 18:54:34:143: Starting SyncToyCmd, version 2.1.0.0, built 19.10.2009 04:04:38.
    SYNC: 03/13/2017 18:54:34:174: *** Folder pair OneDriveSync not found.

    Ran manual for check and all working fine.
    Any suggestions how to fix this?
    Appreciate your thoughts

    1. Copied wrong part from log: should have been

      SYNC: 03/13/2017 19:29:02:842: Starting SyncToyCmd, version 2.1.0.0, built 19.10.2009 04:04:38.
      SYNC: 03/13/2017 19:29:02:938: *** Failed to execute folder pair BU DeltaL. Could not locate folder S:\DeltaL 211216\.
      SYNC: 03/13/2017 19:29:02:938: *** Failed to execute folder pair BU pictures. Could not locate folder V:\.
      SYNC: 03/13/2017 19:29:02:938: *** Failed to execute folder pair BU PC files. Could not locate folder W:\.
      SYNC: 03/13/2017 19:29:02:939: *** Failed to execute folder pair BU private files. Could not locate folder X:\.
      SYNC: 03/13/2017 19:29:02:939: *** Failed to execute folder pair BU Media files. Could not locate folder Z:\.

      1. Hi Dave,

        Wondering if this is a permissions issue with the account that you have set to run the batch file with in scheduler. Are you running with an account that’s different to that which you log onto the machine with?

  4. I decided to use this method but in a way that I think is potentially more reliable. My setup is a little different: one desktop PC and multiple laptops in our household. Normally we would all access files located on our NAS and use it as the “working” location. But now we’re using your method, sort of turned around, so that we use cloud based (OneDrive) data and then use the NAS only as a backup.

    So, instead of thinking about it as syncing from the NAS to OneDrive, I am doing it the other way around. I made OneDrive my working directory by moving all of my NAS data into my OneDrive folder on my PC. Then I created a sync routine to mirror OneDrive to a folder on my NAS. That makes my NAS the backup location only (not a “working” location). If you do this, just make sure that your main PC which syncs with your NAS has all folders set to “Always keep on this device” within OneDrive (right click on the folder to see the setting). That way you know everything will be local on your PC and will get backed up to the NAS.

  5. Teodoro Junior

    The Realtime Sync feature from Freefilesync is quite useful, it’s does the thing really realtime. You should take a look.

  6. Hi.
    All I need is to back up my NAS drive to my C drive (which is bigger and not very much in use). Back Blaze backs up my C drive and I have a local and a web based backup (which is how I protect my data).
    It would seem to be easier than using the OneDrive.
    Any thoughts?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.