Backing up Windows Server 2008 & Exchange Server 2007 With Bacula
UPDATE: This article is somewhat out of date. Bacula has provided a native plugin for performing backups of the database store for quite a while. Visit www.bacula.org for more information!
Over the past couple of days I’ve been battling away trying to get the Win32 Bacula agent to back up my Windows Server 2008 System State and Exchange Server 2007 Information Store Databases.
Bacula currently doesn’t support VSS backups of a 64-Bit version of Windows Server 2008, so there’s a number of hoops you have to jump through to get even a semi-reliable System State & Exchange backup. For an Exchange backup we use the NTBACKUP binaries from Windows Server 2003 64-bit and for the System State we use the Windows Server 2008 wbadmin tools.
For both jobs we’ll use a couple of “Client Run Before Job” commands to trigger client-side scripts to run the client-side backup jobs.
WARNING: This method works for me, but please test and then test some more before relying on any backups made like this!
Exchange Backups
First of all, grab the ntbackup.exe, ntmsapi.dll and vssapi.dll binaries from a Windows 2003 64-bit server. They should be located in C:\Windows\System32 by default. Place the binaries in their own directory. eg: C:\Program Files\NTBackup
Next, create a folder to store the scripts & Exchange database backup files. eg: C:\Backup
Run NTBackup, cancel the wizard, click the ?Backup? tab, browse the tree and tick “Microsoft Information Store” under your Exchange Server:
Click “Job” then “Save Selections”, save the file as “C:\Backup\Exchange Backup.bks” then exit NTBackup.
Create a text file in C:\Backup named “BackupExchange.cmd” with the following contents (watch for line-wrapping, the following should be all on one line):
start /W “” “c:\Program Files\ntbackup\ntbackup.exe” backup “@c:\backup\Exchange Backup.bks” /N “Exchange Backup” /F “c:\backup\Exchange Backup.bkf” /FU /L:f /M normal
This script will run a full Exchange Information Store backup on-demand and store it in C:\Backup\Exchange Backup.bkf, overwriting this files previous contents.
Next, we’ll edit our existing Bacula client config to skip the C:\Backup folder for standard backups and create a a new job to trigger the above script and backup the C:\Backup folder:
Client {
Name = exchange-fd
Address = exchange.server.address.here
FDPort = 9102
Catalog = MyCatalog
Password = “my_bacula_fd_password”
File Retention = 30 days
Job Retention = 6 months
AutoPrune = yes
Maximum Concurrent Jobs = 1
}Job {
Name = “Exchange”
JobDefs = “DefaultJob”
Schedule = “MondayFull”
Client = exchange-fd
FileSet = “Exchange FileSet”
Write Bootstrap = “/var/lib/bacula/exchange.bsr”
}Job {
Name = “Exchange DB”
JobDefs = “DefaultJob”
Schedule = “MondayFull”
Client = exchange-fd
FileSet = “Exchange DB”
Write Bootstrap = “/var/lib/bacula/exchangedb.bsr”
Level = Full
Client Run Before Job = “C:/Backup/BackupExchange.cmd”
}FileSet {
Name = “Exchange FileSet”Include {
Options {
signature = MD5
compression = GZIP
}
File = “C:/”
}Exclude {
File = “C:/pagefile.sys”
File = “C:/Backup”
}
}FileSet {
Name = “Exchange DB”Include {
Options {
signature = MD5
compression = GZIP
}
File = C:/Backup
}
}
Once we’ve done this, we can reload the bacula config and we’ll be good to go!
System State Backups
System state backups are a bit trickier. Because we’re running the 32-bit Bacula-fd binary, we’re inside the 32-bit WOW compatibility environment. Inside this environment, C:\Windows\System32 is remapped to C:\Windows\SysWOW64 which contains 32-bit binaries. However, the backup tool we require (wbadmin) is 64-bit only and is not available to us due to this re-mapping. Attempts to copy the wbadmin.exe binary to another location proved unsuccessful with other strange error messages.
However, the following method/kludge does work:
Copy the 64-bit C:\Windows\System32\cmd.exe to C:\Backup
Create a text file in C:\Backup named “BackupSystemState.cmd” with the following contents (watch for line-wrapping, the following should be on 2 lines, each starting with “start /W”):
start /W “” c:\backup\cmd.exe /C start /W “” c:\windows\system32\wbadmin delete systemstatebackup -backupTarget:d: -keepVersions:0 -quiet
start /W “” c:\backup\cmd.exe /C start /W “” c:\windows\system32\wbadmin start systemstatebackup -backupTarget:d: ?quiet
This script works by first of all launching the 64-bit command-prompt, then in turn launching the wbadmin backup process. The 2 commands being run here first of all delete any existing System State backups from D:, then starts a new System State backup with D: as the target volume.
Next, we’ll edit our Bacula client config again, adding the following new FileSet and Job:
Job {
Name = “Exchange SS”
JobDefs = “DefaultJob”
Schedule = “MondayFull”
Client = exchange-fd
FileSet = “Exchange SS”
Write Bootstrap = “/var/lib/bacula/exchangess.bsr”
Level = Full
Client Run Before Job = “C:/Backup/BackupSystemState.cmd”
}FileSet {
Name = “Exchange SS”Include {
Options {
signature = MD5
compression = GZIP
}
File = D:/
File = C:/Windows/Logs/WindowsServerBackup/
}
}
After reloading the Bacula config, you should be all set!
Drop me a line if you have any comments/suggestions.
7 thoughts on “Backing up Windows Server 2008 & Exchange Server 2007 With Bacula”
Hi Sean! Just wondering… How did you managed to install Bacula client on a Windows 2008 Server?? I’ve been trying to install it but it was impossible for me to success…
Any thing i’ve been missing?
Cheers,
Chiru,
Hi,
I just downloaded and installed the 32-bit Bacula-fd from the Bacula Sourceforge page. The service installed and after editing the config file to point at my Bacula director, it worked first time.
If you’re still having problems, it might be worth checking the Bacula-Users mailing list.
Sean
Thanks Sean, just the first 2008 i’ve tried and everything worked fine with right-click -> “run as administrator”.
And again thanks for this article!!
Cheers,
Chiru
Stellar article! I’ve been looking for solid evidence of how I can save money on backup software for my environment and your article was illuminating. Any updates?
I’ve not tried this yet, but there is a Bacula plugin available to natively backup Exchange now.
Might be worth a try 🙂
Sean
thank you bro for this article, i wanna test this…
I’ve a question if there some evolutions to backup win server 2008 system and Exchange with bacula ?
is the bacula Exchange plugin OPEN source ?
This article is somewhat out of date now. Bacula has provided a native Exchange plugin to properly back up the databases for quite some time. Please visit http://www.bacula.org for more info.