How to Sync a NAS Drive with OneDrive

HowtoSyncNASDrivewithOneDrive

Cloud, Cloud and more Cloud – it’s a pretty common term now in business and is becoming just as common at home.  Cloud storage is a big market and Microsoft OneDrive has been around for a while, formally SkyDrive but essentially the same service.  Cloud drive providers are now popping up all over the place but OneDrive in my opinion remains one of the best.  With very little effort, you can setup a free 15GB account.

I use both a NAS (Network Attach Storage) drive and a small server for hosting services such as iTunes.  I’ve managed to upgrade my OneDrive disk space to 30GB by enabling my camera roll and wanted to be able to sync my network drive data with the cloud.

Since writing this guide it’s become apparent that real time sync programs are not without their challenges. I’ve written an updated guide on Using SyncToy to Sync NAS with One Drive  that you may find useful.

It may also be worth noting that with a recent firmware update, the latest range of Seagate Personal Cloud devices have a native OneDrive app that can apparently allow you to sync directly from your NAS drive.

Home Network Topology with OneDrive

Before we start, let’s take a look at a simple topology diagram of my home network.

OneDriveTopology
The topology of my home network showing my Server, NAS and the connection to OneDrive

As you can see, I use a couple of PC’s and a Server – all of which use the Seagate Central NAS 2TB drive as the main file storage.  This has since been replaced by Seagate’s new Personal Cloud Home Media Storgage NAS which is currently £109 for the 3TB version on Amazon.

The server runs a number of applications such as iTunes and Print Sharing but relies on the NAS for any File Sharing.

Guide Objectives for Syncing Data from NAS to OneDrive

These are the objectives for this guide:

  • 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

How to Sync Your NAS Drive with OneDrive

There are a number of guides discussing how to use Symbolic Links as the OneDrive local folder and trying to trick it into using the link as a real drive,  but OneDrive now appears to recognise these methods and prevents using them.  You can still get around this by using the Symbolic link as a sub folder of the OneDrive folder, or use an additional tool to keep your NAS and local OneDrive folders in syc.

Method 1: Symbolic Link Sub Folder

This solution was actually much simpler than I thought.  Essentially you install the OneDrive desktop application on the Server and point it at a folder you can locate easily, for example C:\OneDrive

The OneDrive desktop application will then sync this empty folder with the cloud.  If you’ve already got data on OneDrive, you may need to give this stage time to complete before you continue – how much will depend on your internet connection and of course the amount of data already on OneDrive.

The next step is to create a Symbolic Link from within your OneDrive folder and point it at your NAS drive.  If you’d like to read more about Symbolic Links in general I’d recommend this article.

In this case, I only wanted to sync the contents of N:\Data where N: is the drive letter that maps to my NAS.

I used the following command to create a Symbolic link within C:\OneDrive that pointed to N:\Data called Data.  This uses a Microsoft tool called mklink which is included with all Windows operating systems since Vista.

From a command prompt, enter:

mklink /d data n:\data

What this essentially does is creates a fake subfolder called C:\OneDrive\Data which actually points across the Network at N:\Data.  If you look within the C:\OneDrive folder, you will see what looks like a shortcut icon – clicking on it should take you to your network drive.

OneDrive will then treat this as a normal folder and sync it’s contents meaning you will now have a Data folder appear on your OneDrive that will be in Sync with your NAS drive.  Admittedly, this means that only content withing N:\Data or OneDrive\Data will be Synced, but this gives me the flexibility I need to choose what I want in the cloud.

Obviously having a server always running helps keep this process running nicely, but it would work just as well from your desktop – it would just mean that it would only sync while it was turned on.

Method 2: Use a tool such as FreeFileSync

If you don’t want to rely on the OneDrive client being able to pickup changes from the Symbolic link – after all we’re essentially tricking the OneDrive client into beleiving it’s a real folder so mileage may vary especially over time, there are a number of tools that are able to keep folders in sync. One which does this very well and in real time (remember our objectives) is an amazing free tool called FreeFileSync.

Essentially you setup in the same way as the Symbolic Sub Folder approach above, but instead of using a Symbolic link you use FreeFileSync to keep the C:\OneDrive folder in sync with N:\Data.

You can export your settings as a Batch File and then use the included RealtimeSync program to watch for changes and when it spots any at either location – run the batch file you created.

Introducing an additional program into the solution does make things a little more complex to initially setup and maintain – but it’s worth noting that as long as you find a way to keep your local OneDrive folder in sync with your NAS drive location – the OneDrive client does a pretty good job of the rest.

Testing the Sync between Your NAS Drive and OneDrive

Testing should be easy enough to do.

Once the first sync has completed (you can tell this by looking at the one drive icon)

If it looks like this with the animated bar moving below it:

onedriveupdating

It’s still busy syncing.  Go grab a coffee, or take a walk – perhaps even call an old friend you haven’t spoken to in a while and say hi.

But If it looks like this:

OneDriveDoneSync

You’re good to go – your old friend can wait.

To test, I’d recommend creating a Folder within your NAS drive called something like LocalTest.  Give it a few moments to sync then access your OneDrive through a browser, if the folder is showing – you’re good to go.  To ensure the Sync is working both ways, it might also be worth creating a CloudTest folder within your OneDrive account through a browser and watching for it syncing back to your NAS drive.

If both of these are working, congratulations – you are in sync!

Conclusion

I’d say we’ve hit our objectives.  You should now have an automatic Sync between your NAS drive and OneDrive that cost you nothing other than a little time.  Good job!

I hope you find this short guide useful, it’s certainly made my life a bit easier.

If you’ve got any thoughts or questions, particularly on the setup of FreeFileSync please post them in the comments below.  Thank you for reading.

Since writing this guide it’s become apparent that real time sync programs are not without their challenges. I’ve written an updated guide on Using SyncToy to Sync NAS with One Drive  that you may find useful.

Author: BigGeek

Wayne is a self-proclaimed geek, IT Professional, father of two and husband who's still much closer to 40 than 50. When he's not busy in an otherwise hectic life he takes time to blog on all things that warrant an online opinion. Founded in 2012, ePINIONATED has been a guilty pleasure for Wayne, giving him an online voice in a very noisy Interweb – some of which might even be useful, maybe.

17 thoughts on “How to Sync a NAS Drive with OneDrive”

  1. If I install this on a laptop instead of a server and use the laptop at work while it is disconnect from the NAS but still connected to the internet, is there a risk that Onedrive will think I’ve suddenly deleted everything locally and then wipe my files online?

    1. Hey Julian and thanks for the question – it’s definitely an interesting one.

      I would think that if you’re pointing to your NAS using a Symbolic link and suddenly that link becomes empty, it’s possible two things will happen.

      Firstly it may as you state wipe out the contents of your OneDrive – especially if you have everything in a subfolder that it now thinks is empty, or secondly and potentially just as bad – it might actually download your OneDrive again this time to your Laptop and overwrite the symbolic link although I think this is unlikely.

      I guess an easy way to test would be to create a test subfolder on your OneDrive and point the symbolic link at that instead of the root of your NAS data. Then maybe create some test files and actually test to see what would happen.

      Please let us know how you get on, I’m sure others would be interested in reading your findings.

    2. Hello Julian,
      Have you tried the scenario you mentioned (installing on your laptop and then disconnecting from the network of the NAS)? As BigGeek indicated: please let us know how you get on, I’m sure others would be interested in reading your findings.
      Thanks!
      Kris

  2. a few things to keep in mind with either of these methods (i’ve tried both and each have their pros and cons.)

    as far as symbolic links are concerned, they will work if set up as described above, but if you ever need to reinstall onedrive (microsoft’s solution to every onedrive problem) you will have a very hard time getting the client to recognize the existing symbolic link as valid. essentially it will duplicate the data, pulling down everything in the cloud version of that directory, renaming your local symbolic link directory and uploading that again. if you have a fairly large amount of data in there this can take days given how slow onedrive transfers files. once the two directories exist (the original will be renamed something like “data-computername”) you can trick it again by deleting the downloaded extra directory and renaming the local symbolic link. like i said, it will work, but it’s a major time drain. microsoft does not officially support this solution.

    using a filesync tool like freefilesync should always work, but the drawback here is that you will be keeping an extra copy of the data on your c: drive. often large data stores are kept on a network drive to save room on the local hard drive. this is especially true if you have a smaller solid state drive. plus you have the extra overhead of sync operations running to and from your NAS as well as onedrive.

    so neither solution is perfect, but both do work to a degree. the real solution would just be for microsoft to support syncing to network storage devices either through symbolic links or directly.

  3. The symbolic link trick does not work. Onedrive tells me it can’t sync “because the folder contains a symbolic link”…

    1. Wonder if they have updated the client to check for them.

      Are you in a position to use an alternative like Freefilesync or DSync?

  4. Not really, the computer I’m using is more like a client and has little internal storage.
    Guess I’ll need to use an external drive synced to the NAS and sync that drive to Onenote. How convenient.

    1. I still don’t understand why they don’t support network drives natively – would make everyone’s life much easier.
      I had a look at Amazon Cloud storage over the weekend and to be honest, they seem even further behind the curve – their client doesn’t even support normal sync so basically you get a huge cloud storage area that you’ve got to manage manually.

  5. Thanks for the article… I’m looking to do something similar but syncing to SharePoint (Office 365 tenant).. the idea is having everything locally in the office on a NAS for performance (large files) but sync’d to SharePoint for access outside the office.

    I’m wondering:
    1. Anyone done this – any thoughts or warnings for me?
    2. Any issues with impact on Versions / Time Stamps, e.g. if using FreeFileSync do you lose versions and timestamps in SharePoint?

    Thanks!

    1. For anyone reading this… I just tried FreeFileSync and while it seems pretty good I didn’t get far because although it was easy to sync from a SharePoint library to a NAS location:
      – File versions are lost when you edit on the NAS
      – Date/Time stamps are reset when you edit on the NAS

      Makes it a non-starter for me.

      1. Hi Lance and thanks for sharing. Sorry to hear that this solution won’t work with Sharepoint and it’s timestamps.

        I know it’s a little old fashioned, but I believe Robocopy has more granular control over flags and stamps – the only problem being that you’d have to schedule it’s execution.

        Is this something that might get closer to what you need?

        1. Maybe… I’m trying to set something up for someone else though… needs to be simple and fool proof so I prefer something with a GUI they can see / check. If Microsoft is listening, it just seems ridiculously difficult to achieve something that clearly people want / need. i.e. don’t assume everyone has superfast always on internet and only ever works with MS Office files!

          I stumbled across another option called SPSync that I might try out… I think it was only a ver 0.9x so was preferring something that had least made it past ver 1… but hey if it works!

          1. I agree – seems a massive oversight not including the ability to natively sync with local network storage. To be fair though, they often seem to ignore the home user who may have slightly more complex requirements than usual (like Outlook.com and custom email domains for example).

            Good luck with finding a solution Lance and feel free to call by if you do get something working.

    1. Some NAS drives do support OneDrive Sync. I’ve heard some good things about the range of Seagate NAS Personal Cloud devices and that they do have a native OneDrive agent. If these work as advertised, you would be able to do exactly what you’re asking.

We would love to hear from you...