Windows Server Backup in win2k8 server is fantastic - it's a consistent, snapshot-based automatic backup system capable of full disaster recovery / bare metal restore. I'm not a huge fan of much of the way the Windows servers work, but the backup setup is fantastic. With one wee flaw...
Manual backups may be made to a network share, or to a local volume then copied to a network share. Fuss free, but only with operator intervention.
Unfortunately, automatic scheduled backups require direct access to a drive, they won't work on a mounted NTFS volume or on a network share. This doesn't do me much good for disaster recovery, as even a USB2 or FireWire drive nearby has a good chance of being destroyed by anything that takes out my server. It rained (and hailed) in my server room last month, so I'm taking disaster recovery even more seriously, and a nearby HDD just isn't good enough.
I could run a FireWire 800 drive over cat5e to the near-site backup location, but that's surprisingly expensive to do, especially as I want redundant storage to protect against pesky HDD failures. I have a perfectly good Ethernet-connected Linux server with a 10TB RAID array running Bacula to back up everything else on thge network, and I'd prefer to just use it for Windows Server Backup too.
The solution: Win2k8 has a built-in iSCSI initiator. Simply turn the backup server into an iSCSI target, then use Windows 2008's built-in iSCSI initiator to connect to it so Windows Server Backup sees it as a local disk and can write backups to it. This turns out to be astonishingly easy, at least on an Ubuntu system.
Security notice
The following configuration does NOT authenticate the windows server to the iSCSI target via iSCSI mutual authentication, so it may be possible to trick the server into backing up onto a different server and "steal" the backup. It also passes the actual backup over the network in the clear, as it doesn't use IPSec. You may wish to address those limitations in your implementation.
It would be a very good idea to enable mutual authentication, but by time of writing I was
unable to get it working. The win2k8 iSCSI initiator complained about
secret length, even though the provided secret appeared to match its
criteria and had been entered in the main part of the control panel
where the mutual authentication secret is expected. Similarly, IPSec
wouldn't be a bad idea to prevent your backups passing over the network
in the clear.
Configuring the iSCSI target
First, install the ISCSI Enterprise Target software (IET):
apt-get install iscsitarget
Now provision a volume to export as a target. This may be a local raw disk or partition, a logical volume provided by LVM, or even a great honking file on one of your mounted file systems. I'm using LVM, so I'll just allocate a logical volume:
lvm lvcreate -n winimagebackup -L 300G backupvg
There is no need to format the volume; Windows does that. Just export it via iSCSI by adding a suitable target entry to
/etc/ietd.conf
(it might be
/etc/iet/ietd.conf
on your system):
Target iqn.2010-01.localnet.backup:winimagebackup
Lun 0 Path=/dev/backup/winimagebackup_iscsi,Type=blockio
Alias winimagebackup
IncomingUser iqn.1991-05.com.microsoft:winhostname xxxx
See the comments in the default
ietd.conf
and the
ietd.conf
man page for details on this. In brief:
- Change "localnet.backup" to the reversed host and domain name of your target server's name (mine is called "backup.localnet").
- Change "IncomingUser" to the user name you want the Win2k8 server to have to give to be permitted to connect, and "xxxx" to the password you wish to require. By default a 2k8 box will give the above user name, with "winhostname" replaced with the win2k8 box's hostname.
- Set the path after "Path" to the location of your storage.
- If you're using a file, you may need to specify "fileio" instead of "blockio" as the Type.
Restart ietd, and you're ready to connect the 2k8 box.
Connecting 2k8 to the iSCSI Target
Connecting to the target from win2k8 is similarly trivial. In the iSCSI Target control panel, in the "discovery" tab enter the dns name or ip of the target.
Do not configure authentication (unless you've deviated from the
ietd.conf
above), just accept the dialog.
The server should appear in "target portals" and no error
should be displayed. If successful, go to the "targets" tab, where you
should see a target named "winimagebackup". Click "Log on..." to connect
to it. Check the option to restore the connection at boot-time. Under
Advanced, Configure CHAP authentication, using the password given in
ietd.conf for IncomingUser under the target winimagebackup. Do not enable mutual authentication*. Accept
the dialog, and the status of the volume should change to "connected".
Configuring Windows Server Backup
You're now ready to use Windows Server Backup with the volume. You do not need to format it under the disk mmc snapin before use. Just fire up Windows Server Backup and click "Backup Schedule", then follow the prompts, picking the iSCSI target as the backup storage when prompted.