Backing up the Windows Home Server backup database and files
Introduction
In the event of a disaster it’s best not to have all your data in the same place. The trouble with Windows Home Server backups, is that they are generally in the same building as the client PCs, so if you lose the building, you lose everything. The following method will allow you to do an encrypted backup to a remote drive that could live, for example, in your garden shed.
A feature that was pulled from Performance Pack 1 was the ability to backup the client backup files. An add-in was developed that automated the documented process that Microsoft published, though the PDF file that contains those instructions, now seems to have been removed / moved.
The manual process was:
1. Run mstsc.exe to start a Remote Desktop Connection session to your home server. 2. Plug in an external hard drive to your home server (do not add it to the Server Storage through the Windows Home Server Console). 3. Open a Command Prompt, Click Start, Run and type CMD 4. Type net stop PDL 5. Type net stop WHSBackup to stop the Windows Home Server Backup service. 6. Copy the contents of to the external hard drive: 7. Type net start WHSBackup to restart the Windows Home Server Backup service. 8. Type net start PDLI’ve developed this manual process into a an automated script that will give you a fully encrypted backup of both the PC backups and the WHS shares to any NAS drive or server that supports files over 4Gb. For my system, I’m using a 500GB Freecom Network Drive Pro. It has to be the Pro version as the cheaper one only supports FAT32 as a file system. FAT32 has a 4GB single file limit. The Pro supports ext3 which doesn’t. The NAS drive can then be located off-site i.e in the shed or garage.
Assumptions
You already have a backup of all your data on another media or are using a test server.
You are confident in using MSTSC and creating command files (batch files).
Your WHS does not already have a T: drive
You have a working NAS drive/server that supports large files
Download the software
Two pieces of software need to be installed on the WHS. Firstly Robocopy, which can either be installed as part of the Windows 2003 Server resource kit, or by itself, with a later version, from the RoboCopy GUI http://technet.microsoft.com/en-gb/magazine/cc135870.aspxkPick Robocopy from the November 2006 section.
If you don’t want an encrypted backup, skip the TrueCrypt parts and replace the mount and dismount parts of the script with drive mapping commands, but if you do, it can be downloaded from www.truecrypt.org. These instructions are based on 6.1a.
Prepare the NAS drive
I’ve named my NAS drive the same as my WHS, but with a -B suffix, so in these examples it’s called \\SNOOPY-B. I’ve created a share called WHS and a user called Administrator with the same password as on my WHS. The user has full access to the share.
Logon to your WHS
You need to logon to you WHS using MSTSC.EXE to get a remote desktop session to the server. Logon as Administrator using your administrator password.
TrueCrypt Setup/Installation
Run the setup program and accept the defaults for everything. Installation will take less than one minute.
Creating the encrypted container
Run TrueCrypt from the desktop icon and select ‘Create Volume’
Select ‘Create an encrypted file container’ and select ‘Next’
Select ‘Standard TrueCrypt volume’ and select ‘Next’
Enter a volume location of ‘\\SNOOPY-B\WHS\Backup.raw’ and select ‘Next’
Pick an encryption and hash algorithm or just accept the defaults and select ‘Next’
Select the size of the volume you want to create. You should pick roughly the same size as your WHS. Be aware that a 400Gb volume may take 20 hours to create! Select ‘Next’
Enter the Volume password. Don’t go overboard with the password as it has to be stored in plain text in the script anyway. In this case it was ‘Password’. Select ‘Next’
Change the File system to NTFS, move the mouse around for a bit, then select ‘Format’. If the format does not start, move the mouse around some more.
Sit back and wait…..
Select ‘Exit’ to quit the Wizard and ‘Exit’ to quit TrueCrypt.
RoboCopy Setup/Installation
Run the setup program (UtilitySpotlight2006_11.exe)
Unzip the files to C:\Temp
Copying the Scripts
Create a folder under ‘C:\Program Files’ called ‘Conscious’
BackupShares.cmd
REM Windows Home Server Off-Site encrypted backup of shares folder
REM (C) 2008 www.HomeAutomation-Direct.com
REM Released under GPL. No consequential loss or damages accepted. Use at your own risk!REM Mount the TrueCrypt container on T: No user output
“C:\Program Files\TrueCrypt\TrueCrypt.exe” /V \\SNOOPY-B\WHS\BACKUP.RAW /L T /P “Password” /Q /SREM Copy the “shares” folder in Mirror Mode, Restartable, All attributes, No progress, 4 retries, 5 second wait between retries, Log to file, Console output
Robocopy D:\shares T:\shares /MIR /Z /COPYALL /NP /R:4 /W:5 /LOG:”C:\Program Files\Conscious\BackupShares.log” /TEEREM Dismount the container
“C:\Program Files\TrueCrypt\TrueCrypt.exe” /D /Q
BackupBackups.cmd
REM Windows Home Server Off-Site encrypted backup of backup folder
REM (C) 2008 www.HomeAutomation-Direct.com
REM Released under GPL. No consequential loss or damages accepted. Use at your own risk!REM WHS will complain if the services are stopped for too long!
REM In this example, destination NAS drive is called \\SNOOPY-B with a share called WHS
REM TrueCrypt volume is called Backup.raw. Password for TrueCrypt volume is “Password”REM Start the Drive Letter Service
NET STOP PDLREM Start the Backup Service
NET STOP WHSBackupREM Mount the TrueCrypt container on T: No user output
“C:\Program Files\TrueCrypt\TrueCrypt.exe” /V \\SNOOPY-B\WHS\BACKUP.RAW /L T /P “Password” /Q /SREM Copy the “backup” folder in Mirror Mode, Restartable, All attributes, No progress, 4 retries, 5 second wait between retries, Log to file, Console output
Robocopy D:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4} T:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4} /MIR /Z /COPYALL /NP /R:4 /W:5 /LOG:”C:\Program Files\Conscious\BackupBackups.log” /TEEREM Dismount the container
“C:\Program Files\TrueCrypt\TrueCrypt.exe” /D /QREM Start the Backup Service
NET START WHSBackupREM Start the Drive Letter Service
NET START PDL
Testing
Make sure you either have a backup copy of all your shared folders, or you are running this on a test server. I used Microsoft Virtual PC (free download) to develop the scripts before installing it on my real server. Be aware that the /MIR option on RoboCopy will DELETE files so if you get the parameters wrong you will lose data.
Type ‘BackupShares.cmd’
The script should run and all the files will be copied across to the NAS drive. A summary will be shown at the end and a log file will have been created in the same folder. If you run it again, it should be a lot quicker as it will have nothing to do and the summary should reflect this in the Skipped column.
Once you are happy that’s working, you can backup the backups.
Type ‘BackupBackups.cmd’
Again , the script should run and all the files will be copied over. The only difference with this script is that it needs to stop and start a couple of services. WHS will warn you this has happened, but you can ignore it.
Scheduling the scripts
You can use the built-in Scheduled Task service (under control panel) to schedule the scripts to run. The BackupBackups one should be run outside of your WHS backup window i.e. after it, because if it runs during it, the backups will fail. The BackupShares script can be run at anytime. If you have masses of data you can limit the run time of the scripts through the scheduled task. RoboCopy has been setup to use restartable mode so any files that are being copied will just continue the next time it runs.
Real World timings
The following timing were taken from my production WHS running on a Tranquil PC, connected over a 1Gbs network to a Freecom Network Drive Pro, backing up two laptops and a PC.
Creation of a 450Gb encrypted volume: 20 hours
Initial copy of ’shares’ folder: 214Gb in 9.5 hours
Second run the next day: 0Gb in 3.5 minutes
Third run: 0Gb in 3.5 minutes
Initial copy of ‘folder’ folder: 94Gb in 4.5 hours
Second run the next day:81Gb in 4 hours
Third run: 5Gb in 14 minutes
It would seem, that when the PC backup cleanup runs (on a Sunday), the timestamp on every backup file is updated, so RoboCopy has to re-sync it. I don’t know why it does this so I’d be interested in other peoples thoughts. Apart from that, just the changes are transferred to the NAS drive everyday.
Shameless Plug
www.EnergyMonitors-Direct.co.uk
Energy Monitors Direct is an online supplier of the best energy monitors available to help you save money and reduce your carbon footprint. Even small savings will help reduce climate change.









December 15th, 2008 at 4:37 pm
[...] You can read the guide here. [...]
February 22nd, 2009 at 10:10 pm
I recently had occasion to use your backup utilities after losing part of my WHS backup file during migration to and reconfiguration of new server hardware. I simply reversed the “D” and “T” in the “Robocopy” line, and it worked great as a restore function. Restored my WHS backups perfectly! Thank you for such a useful service.
July 17th, 2009 at 6:02 pm
[...] WHS users to figure out a protection method on their own; late last year, one independent user figured out a method with the help of TrueCrypt and RoboCopy. Since then, Power Pack 2 was released last March, but even [...]