Robocopy saves the day
May 12, 2009Dan No Comments »If you’re like me, you have a lot of data on your computer. Some of it backed up elsewhere, some of it replacable. Chances are, you even have some data on your harddrive right now that is neither replaceable nor backed up. Gasp! If your harddrive died today, it would be lost to the digital ether forever. To the great harddrive in the sky, where no bits ever return. This would be (decidedly) bad.
The solution, of course, is to back up your data regularly. Or to not care about your data. Or to not have data at all. But I digress — I care about my data so I try to back it up regularly. Not only do I run my main computer with RAID 1 to protect against a (good deal of) hardware failures, I recently acquired a SCSI disk array that I run backups to.
All my important data is housed in my user profile on Windows Vista, so this is what I keep regular backups of. Now, I could just regularly copy the entire directory to the disk array every once in a while, but this would rewrite a lot of files that don’t need to be rewritten. In fact, very few files are written or changed in terms of the entire profile, which mostly stays the same. To save time and energy (and be sorta cool) I use robocopy to copy over my profile. Without going into too much detail, robocopy is a Windows utility which will compare 2 storage locations and synchronize them, only copying over files that are new or have been modified more recently than that which is on the destination drive.
There are a couple of gotchas when doing this with a Windows profile. The first is that profiles contain NTFS junction points, which are essentially links that perform just like the directory they are linking to. Robocopy will try to copy these by default and end up in lovely infinite loops. So use the /XJD option. Another gotcha is there are certain files that Windows won’t release control of when the profile is ‘live’. So you must exclude files like ntuser.dat, mozilla’s sqlite files, etc using the /XF option. To make a long story a little bit shorter, this is the command that I used to backup my profile to my disk array (I:) with success:
robocopy c:\users\<userid> i:\<destination> /s /XF *.dat.* parent.lock *.sqlite* /XJD /DCOPY:T /XD c:\Users\<userid>\AppData\Local\Microsoft c:\Users\<userid>\AppData\Local\Temp
Note: you may want to make sure there’s no important data in <userid>\AppData\Local\Microsoft and <userid>\AppData\Local\Temp before running this — I had nothing but a bunch of useless files windows was using and wouldn’t let me copy.
There it is. Data integrity is fun!
Join the discussion