Friday, August 27, 2010

How to back up windows with Bacula

SkyHi @ Friday, August 27, 2010
Bacula is an open source system used to manage backups across multiple computers running different operating systems.
This assumes that you already have the Bacula director installed and functioning correctly. This procedure has been verified to work using CentOS 4.6 running as the director and Windows Server 2008 as the host to back up.
Step 1: Install the Bacula client on the windows machine you want to back up
As of this writing, these can be found here:
http://sourceforge.net/project/showfiles.php?group_id=50727&package_id=110235
When you get to the Client Configuration section of the installation, provide a client name (usually hostname-fd), and a client password. Make sure you note what these are because you will need to enter them later in the director configuration.
When you get to the Remote Director Configuration section of the installation, you will need to provide some information from the director itself. Look in the bacula-dir.conf file (found in /etc/bacula on CentOS) and search for the the line that starts with "Director {".
Set the remote director name to the name shown in the configuration file (typically hostname-dir)
Set the remote director password to the password shown in the configuration file (without quotes)
And set the remote director address to the ip address or host name of the director.
If you're not running with standard ports, you will need to set them accordingly.
Allow the installer to create the template file C:\hostname-fd.conf. This will be useful when adding the configuration to the director.
After the installer finishes, double check that the windows service started correctly (Start | Administrative Tools | Services). If it isn't started, start it manually.
Step 2: Verify that the client has access to the director
At this point, you should be able to connect to the bacula director from the windows host. To verify, go to Start | All Programs | Bacula | bconsole. It should provide you with a * prompt. If it is unable to connect, you should verify that the client has the correct password for the director, and that the connection isn't being blocked by a firewall (iptables).
Next, you're ready to configure the director.
Step 3: Add the windows host client configuration block to the director
Edit the director's configuration file. On CentOS, it's /etc/bacula/bacula-dir.conf
Add a new client configuration block to this file. You should be able to cut and paste from the file that was created during the client installation process. Again, the default location for that file was C:\hostname-fd.conf. The client configuration block should look something like this:
Client {
Name = hostname-fd
Address = hostname.domain.com
FDPort = 9102
Catalog = MyCatalog
Password = "Secret Password" # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
Make the Address line is something that the director can resolve. When it created mine, it didn't add a domain and since the director is off-site, the director wouldn't have been able to reach the client.
Step 4: Add the windows host job configuration block to the director
In the same file that you edited in step 3, add the job block. It should look something like this:
Job {
Name = "hostname-fd" #Change this
Type = Backup
Client = hostname-fd #Change this
FileSet = "Windows Client File Set" #Change this
Schedule = "WeeklyCycle"
Storage = File
Messages = Standard
Pool = Default
Write Bootstrap = "/var/bacula/working/rsys-win-www-1-fd.bsr" #Change this
}
Make sure you restart the bacula director. On CentOS, the command to do this is /etc/init.d/bacula-dir restart
Step 5: Test to make sure the director can see the client
From either the director or the client, use the bconsole (/sbin/bconsole on my install) application to connect to the director and once you have a prompt, type in the following: "status client=client_name" where client_name is what you named the client in the director's configuration file. Alternatively, you can just type "status client" and choose from the list.
If it doesn't give you a status, the problem is likely caused by the windows firewall blocking the connection. The default port that you need to allow access to on the windows host is 9102. If you're unsure how to open up a port, take a look at our article on Opening a Firewalled Port on Windows Server 2008.
Step 6: Run a test backup
From bconsole, enter the command "run" and follow your nose to start a backup.
Remember:
  • Always TEST your backups - I can't tell you how many times I've heard of people go to restore from backup only to find that they were configured wrong, were corrupt, etc.
  • Always verify that backups are running - Bacula makes this easy because it can send email notifications whenever backups run so if you stop getting emails, you know something is wrong.

REFERENCES
http://www.devtoolshed.com/content/how-back-windows-bacula