Backup Strategy - Robocopy Revisited

29
Apr
2007

Backup Strategy - Robocopy Revisited

For a while now I've been backing up my important data to a removable 80GB USB drive (two actually - one for on-site storage and one for off-site).  I've been using a utility called SmartSync Pro which I've routinely recommended to friends who want to back up their files to a removable drive.

I finally got round to creating some proper batch files today using Robocopy to perform my backups. Robocopy copy ships with Vista and it's a cool file copy utility. For maintaining an in-sync external drive it's great because by default it will only copy files that have timestamp or filesize changes - so that covers new or updated files. It also has a purge option (/PURGE) that when combined with the empty directory option (/E) will remove any orphaned files from the external drive (both of these options can be combined with the /MIR switch which mirrors the destination drive).

I also needed to stop SQL Server and related services so that database files would be backed up as well  - NET STOP <service_name> for each service is included in the batch file along with a NET START <service_name> after the backup has completed.

The last batch file I created simply clones my regular backup drive to a second removable drive for off-site storage.

Several of the comments and variable declarations in the attached batch files were created by another author (the log file format setting in particular) - a sample I found on the net, and for the life of me I can't find the link back to the original files to give credit to (apologies in advance if you happen to come across this post).

I still use the Vista System Backup - creating a Windows Complete Backup - to backup my OS as an image - but I find Robocopy much more flexible (and fast) for backing up data that will be available on removable media - especially when combined with an on and off-site media strategy.

BatchFiles.zip

Category: