Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
West Wind WebSurge - Rest Client and Http Load Testing for Windows

Fixing a SkyDrive Sync Disaster


:P
On this page:

For a few months I've been using SkyDrive to handle some basic synching tasks for a number of folders of mine. Specifically I've been dumping a few of my development folders into sky drive so I have a live running backup. It had been working just fine until about a week ago when something went awry. Badly!

The idea is that the SkyDrive should sync files, but somewhere in its sync relationship it appears that SkyDrive got confused and assumed it needed to sync back older files to my local machine from the SkyDrive server. So rather than syncing my newer files to the server SkyDrive was pushing older files back to me. Because SkyDrive is so slow actually updating data it's not unusual for SkyDrive to be far behind in syncing and apparently some files were out of date by several months.

Of course this is insidious because I didn't notice it for quite some time. I'd been happily working away on my files when a few days ago I noted a bunch of files with -RasXps (my machine name) popping up in various folders. At first I thought my Git repository was giving me a fit, but eventually realized that SkyDrive was actually pushing old files into my monitored folders.

To be fair SkyDrive did make backups of the existing files, but by the time I caught it there were literally a few thousand files scattered on my machine that were now updated with old files from online. Here's what some of this looks like:

SkyDriveFail

If you look at the directory list you see a bunch of files with a -RasXps postfix appended to them. Those are the files that SkyDrive replaced and backed up on my machine. As you can see the backed up files are actually newer than the ones it pulled from the online SkyDrive. Unless I modified the files after they were updated they all were older than the existing local files.

Not exactly how I imagined my synching would work.

At first I started cleaning up this mess manually. In most cases the obvious solution was to simply delete the original file and replace with the -RasXps file, but not in all files. Some scrutiny was required and besides being a pain in the ass to rename files, quite frequently I had to dig out Beyond Compare to compare a few files where it wasn't quite clear what's wrong.

I quickly realized that doing this by hand would be too hard for the large number of files that got hosed.

Hacking together a small .NET Utility

So, I figured the easiest way to tackle this is to write a small utility app that shows me all the mangled files that have backups, allows me to compare them and then quickly select and update them, removing the -RasXps file after choosing one of the two files.

What I ended up with was a quick and dirty WinForms app that allows me to pick a root folder, and then shows all the -MachineName files:

FixSkyDriveForm

I start by picking a base folder and a template to search for - typically the -MachineName. Clicking Go brings up a list of all files in that folder and its subdirectories.  The list also displays the dates for the saved (-MachineName) file and the current file on disk, along with highlighting for the newer of the two.

I can right click on any file and get a context menu pop up to open the folder in Explorer, or open Beyond Compare and view the two files to compare differences which I found very helpful for a number of files where I had modified the files after SkyDrive had updated to an old one. Typically these would be the green files (of which there were thankfully few).

To 'fix' files I can select any number of files in the list, then use one of the three buttons on the right to apply an operation. I can use the Saved files - that is the backup file that SkyDrive created with the -MachineName extension (-RasXps above). Or I can use the current file, which is the file with the right name on disk right now and delete the -MachineName file. Or on some occasions I can just opt to delete both of them. For some files like binaries it's often easier to just delete and them be rebuild than choosing.

For the most part the process involves accepting the pink files, and checking the few green files and see if any modifications were made since the file was updated incorrectly by SkyDrive. For me luckily those are few in number.

Anyways, I thought I share this utility in case anybody else runs into this issue. I've included the VS2012 solution and all the source code so you can see how it works and you can tweak it as needed. The .NET 4.5 binaries are also included if you can't compile.

Be warned though!  This rough code is provided as is and makes no guarantees or claims about file safety. All three of the action buttons on the form will delete data. It's a very rough utility and there are no safeguards that ask nicely before deleting files. I highly recommend you make a backup before you have at it.

This tools is very narrow in focus, but it might also work with other sync issues from other vendors. I seem to remember that I had similar issues with SugarSync at some point and it too created the -MachineName style files on sync conflicts.

Hope this helps somebody out so you can avoid wasting the better part of a full work day on this…

Resources

Posted in Windows  .NET  

The Voices of Reason


 

Dalibor Carapic
June 21, 2013

# re: Fixing a SkyDrive Sync Disaster

I gave up on Skydrive because it was always syncing my 3GB of data. It was draining my laptop battery because my CPU was constantly on 15% load.
I've returned to Dropbox and I'm much happier.

njy
June 21, 2013

# re: Fixing a SkyDrive Sync Disaster

Or, you know, just use Dropbox...

Fero
June 21, 2013

# re: Fixing a SkyDrive Sync Disaster

Why to use Skydrive for file development, instead of using Git or Tfs? Seems like way to hell ...

PilotBob
June 21, 2013

# re: Fixing a SkyDrive Sync Disaster

This is a bit scary. Did you contact MS to report the issue? How could this have happened?

Kip Kniskern
June 21, 2013

# re: Fixing a SkyDrive Sync Disaster

So, have you stopped using SkyDrive? Did you find any reason/resolution to the actual problem?

Rick Strahl
June 21, 2013

# re: Fixing a SkyDrive Sync Disaster

@PilotBob - somebody from Microsoft contacted me and asked a few questions. Frankly, I'm done with SkyDrive, there are simply to many issues with it. As somebody else pointed out it's sucks major CPU while doing its updates on large shares, and officially linked folders aren't supported (and you have to manually force them to sync with a change in the core folders). The main reason I tried using SkyDrive was because I have a ton of free space on SkyDrive.

@Fero - I do use Git (or SVN for older projects) for all my work. My use of SkyDrive wasn't to substitute a source control/sharing, but as a backup mechanism to the cloud. Having some cloud syncing provides some extra backup especially for local projects that aren't on GitHub or an internal shared repository online.

Lot of people recommend DropBox - how does DropBox do with 10gig of data to keep in sync? CPU Load and actually staying synced reasonably well over time? Seemed like SkyDrive was always terminally behind syncing 8gig which is probably why the online files were often 2-3 months out of date.

Jonathan Allen
June 21, 2013

# re: Fixing a SkyDrive Sync Disaster

I've got nearly 100 GB worth of files and I haven't had any problems with Dropbox. It can take a few days for a new machine to fully load everything, but that's a one time cost. Keeping everything in sync after that is fast.

Paperino
June 24, 2013

# re: Fixing a SkyDrive Sync Disaster

I really cannot believe how poor SkyDrive is. Syncing correctly is the P0 of such a product....
On my phone 50% of the upload are "uploadus interruptus" for whatever reason.
On my work desktop every once in a while I have to restart it because it won't detect "new changes" and there is no way to force the client to "sync".
I would switch to dropbox but I have 25GB of storage which is the only positive side....

hongjun
July 14, 2013

# re: Fixing a SkyDrive Sync Disaster

i had similar disaster happened to me as well last night. had 2 VMs. one vm is actively updating files and the other VM is shut down. later on I shut down 1st VM and started 2nd VM who was down before and now my skydrive folders are wiped out with old file structore from 2nd VM. i had to look for other backup solution now

gary giles
December 20, 2013

# re: Fixing a SkyDrive Sync Disaster

SkyDrive has been a disaster since 8.1. I have lost data and days trying to fix it. In the end I have moved to dropbox. This is the 1st in the 18yrs of using ms I am truly angry with them. SkyDrive is totally broken. I have no confidence in it anymore. They should have left well a loan.

Rik Hemsley
February 08, 2014

# re: Fixing a SkyDrive Sync Disaster

Similar issues with SkyDrive here. Seems to me they should have a priority list with 'don't corrupt data' at the top.

I didn't move away from DropBox, only using SkyDrive for copies of some files, just to see if it worked. It doesn't.

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024