At work our main file server is a Windows 2000 server holding 70G of useful, interesting and irreplacable information. It gets dayly incremental tape backups kept offsite, twice weekly full backups, monthly archved backups, all stored on tape. The backup server has no tape drive. Come the fateful day when the main file server dies the first job would be getting the tape drive running on the backup server and then restoring the 70G so that everyone can get on with their work.
Since disk space is cheap I decided to implement a nightly backup copy from the main server to the backup server over the network. If the main server goes down our biggest problem is remapping drive F on everyone's pc to a different share (a hangover from Netware days, nobody uses the UNC path). Once that is done all the files are ready to use, no having to restore anything.
A quick google revealed that Microsoft had a tool to do such a backup in the Windows Server 2003 resource kit called robocopy. This is a command line tool (like all the most useful tools) and is similar to xcopy but, most importantly, can copy file/folder ownership, access permissions etc. We wouldn't want the backup copies to be readable by everyone or no-one but whoever could read them before.
The Windows 2003 version of robocopy works on windows 2000 server but apparently has some bug fixes. I downloaded the Windows Server 2003 resource kit from the microsoft site and I had to install it on my XP system as it refused to install on the Win2k box.
Below is the simple batch file I wrote to do the backup:
rem options:
rem XJ Do not copy mount points or junctions
rem RH:hhmm-hhmm Specify time range that robocopy will work in
rem PF Check above RH time per file
rem COPYALL Copy owner ship, auditing, dates, attributes, all the good stuff
rem MIR Mirror, delete files that not longer exist in source, recurse, copy empty
rem LOG:file Log output to file
rem TEE Log to console as well as log file
rem W:n Wait time between retries (in seconds)
rem R:n Number of retries
rem NP Do not show (or log) progress information
rem NFL Do not show (or log) each file processed
rem XD dir Exclude directory
"c:\RoboBackup\Robocopy" f:\ e:\DriveFBackup\Yesterday /XJ /RH:1800-0730 /PF /COPYALL /Z /MIR
/LOG:c:\RoboBackup.log /TEE /W:1 /R:1 /NP /XD "tmp" "Archived Files"
rem NOT USED
rem ZB Copy in backup mode, then restartable mode, can continue on failure
rem (robocopy.doc says this slows things down so only use if necessary)
rem CREATE Create directory structure but do not copy files. This should be done
rem for any empty target to build the directory structure as it reduces
rem disk fragmentation.
rem Email the log file to peter.
"c:\RoboBackup\blat" c:\RoboBackup.log -to me@work.com -subject "RoboBackup Output"
This script does a 'mirror' backup, it copies new and modified files (based on time stamp and size) and also will delete files in the backup that have been deleted in the original. Hence, after the script runs the backup should be identical to the master.
The last line uses blat a neat little command line mailing tool to email me the log file. This mailing normally fails as this thing is quite capable of generating 60M log files.
I use a batch file holding this to create the scheduler job:
at 18:00 c:\RoboBackup\RoboBackup.bat
I then have to edit the scheduler task in the gui application to tell it to run as administrator and to give it the administrator password. In an ideal world I would run it as the backup user but to achieve that I would have to make sure the 39000 odd directories all have backup user access.
So there you go, let yourself sleep a little bit easier tonight, using free tools (and an expensive operating system).