I use Windows Home Server to backup all my home Windows PCs to a central location. However, lately, I have decided that I would also like to have a copy of what I deem to be critical data available offsite (in this case, outside our home) as well. I investigated cloud backup solutions – Backblaze actually sounds really good and the price is extremely reasonable, but I’m still uncomfortable with the idea of having all of my personal data in the cloud even though logically it makes less sense to do this myself (an apt comparison is storing your cash in the Bank vs. storing it yourself – clearly, storing it in the Bank is way more secure than anything you can attempt on your own). Eventually, I will get over my irrational paranoia and go with a great online backup solution like Backblaze.
In the meantime, I decided to buy a cheap external USB drive on Black Friday, backup critical data to it and then put the drive in our bank locker as our offsite backup solution. The plan is to do this once every 3 months. I got this Toshiba drive from Newegg for $50 and now it was time to figure out how I was going to go about doing my offsite backup.
While Windows Backup is sort of ok, I have always had a love hate relationship with it. It didn’t give enough granular control for my liking. After carefully revising my requirements for offsite backup, I realized that all I needed was a simple tool that could mirror selected folders faithfully to the external hard drive. This is where Robocopy enters the picture – Robocopy is a command-line tool that ships with Windows since Vista. It has a lot of options to allow powerful scripting of all types of storage management tasks. The tool has a brief but meaningful help option that tells you all you need to know about how to use it and what the different options do.
Here’s the command line that I’m using for backing up folders to my external drive – Run this from an administrative command prompt as the backup option requires it:
robocopy <SourceFolder> <DestinationFolder> /MIR /XJD /R:3 /W:3 /V /NP /NODCOPY /B /TEE /J /LOG+:<LogFile> /MT
/MIR option mirrors the source directory to destination
/XJD excludes directory junctions
/R:3 and /W:3 specifies retry 3 times with a wait of 3 seconds between retries when there are failures in copying a file
/V specifies verbose logging
/NP specifies no percentage progress for file copy
/B specifies use backup mode – this is useful for copying files that have access control restrictions that would prevent your regular user account from opening them
/J specifies use unbuffered I/O – prevents performance degradation from the backup operation (without this, the filesystem cache will be effectively flushed by the backup operation with useless data)
/TEE /LOG+ specifies that output should go to both console and appended to the specified log file
/MT specifies multi-threaded copy- uses 8 threads by default