Managing Bacula Using Webmin

Introduction to Bacula

Bacula is a set of computer programs that permit you to manage backup, recovery, and verification of computer data across a network of computers of different kinds. Unlike simpler backup systems, it can be used to backup multiple remote client systems from a single administration interface, and store those backups on multiple remote storage devices such as tape drives or files in the filesystem.

Bacula is comprised of three programs (or daemons as they are called by Bacula) :

The Director
This program is responsible for storing information about all backup clients and jobs, starting and stopping jobs, and co-ordinating communication between servers and programs. In a typical Bacula system, there is only one director program running on the network.

The File Daemon
This daemon is responsible for actually reading the files to be backed up, and sending them over the network to the storage daemon for writing to the backup destination. If you want to backup multiple clients on a network, each must be running a file daemon.

The Storage Daemon
This program accepts the data provided by file daemons and writes it to the final destination, which may be a locally attached tape drive or a file on the server.

In the simplest case where you only want to backup a single machine, all these daemons will run on that one host. When Bacula is installed for the first time, the initial default configuration will be setup like this.

In a more complex network, one host may run the director, file daemon and storage daemon, and others would run only file daemons. In an even more complex environment, several additional storage daemons may be added as well, on hosts that have a large amount of disk space or have attached tape drives.

Installing Bacula

The easiest way to install Bacula is from the RPMs provided by www.bacula.org - assuming that your operating system supports RPM packages. There are two types of RPM package available :

File daemon only
This package (called bacula-client) sets up only a file daemon on the target system. As such, it should only be installed if you are installing a director somewhere else on your network. The RPM to use in this case is named something like bacula-client-1.38.9-1.fc4.i386.rpm (for Bacula 1.38.9 on Fedora Core 4). You should select the RPM most suited to your distribution, if one is available.

Director, storage and file daemon
This RPM installs the full Bacula suite of programs, and configures them to communicate with each other. If you are just starting out with Bacula, this is the package you need to install first.
The director must make use of an SQL database to store information about completed backup jobs, so this package is available in three different formats – one for MySQL (bacula-mysql), one for PostgreSQL (bacula-postgresql) and one for SQLite (bacula-sqlite). I recommend using the package for MySQL, although the PostgreSQL version will work too. Both require that you have a running database server of the appropriate type, preferably on the same system as the director.
The RPM to install for the full Bacula suite is named like bacula-mysql-1.38.9-1.fc4.i386.rpm (for Bacula 1.38.9 on Fedora Core 4, using the MySQL database). Again, you should select the RPM most suited to your distribution.
If your MySQL or PostgreSQL server has the default login and password set, the appropriate database and tables will be created when the RPM is installed. If not, you will need to manually run the /etc/bacula/create_bacula_database and create_bacula_tables scripts, with the correct command-line parameters to login to your database server.

Bacula Configuration Objects

Bacula directory, file and storage daemon configurations are made up of a variety of different objects, each of which contains various attributes. These can be manually edited in the appropriate configuration files under /etc/bacula , or they can be managed using the Webmin module for Bacula. Every object has a name, which must be unique within its type.

The most important object type in the director configuration are :

Director Configuration
This object contains global settings for the director.

Backup Clients
Each of these specifies one remote backup client (running a file daemon) that the director can communicate with.

File Sets
Each object of this type contains a list of files and directories to backup.

Backup Schedules
This defines a set of schedules on which a backup job will be run.

Backup Jobs
These objects are the most important in the Bacula system. Each brings together a client, file set, schedule, pool and storage to specifiy exactly what should be backed up from where at what time.

Volume Pools
A pool is a set of volumes (tapes or directories) to which backups can be made.

Storage Daemons
Each object of this type defines a storage daemon that the director can communicate with, and a device on that daemon.

The important storage daemon objects types are :

Storage Daemon Configuration
This object contains global settings for the storage daemon.

Storage Devices
Each of these defines a tape drive or directory to which backups can be written.

Storage Daemon Directors
Each object specifies a director that is allowed to connect to this daemon.

The only important file daemon object types are :

File Daemon Configuration
Contains global settings for the file daemon.

File Daemon Directors
Each of these specifies a director that is allowed to connect to this file daemon.

All of these objects will be explained in more detail later on in this documentation, in the sections that cover their management using Webmin.

Security

Bacula's security system is based on passwords, which are shared by both the client and server daemons. Each client configuration object in the director has a password that it uses to login to the file daemon. The daemon then validates this against its password for that director, which is stored in its configuration file. Only if both the director name and password match will the connection be allowed. The same authentication method is also used for storage daemons.

By default, Bacula sends all control information and backup data over the network un-encrypted. However, in the versions 1.38 and above it is possible to configure the directory and other daemons to use TLS encryption, which both protects the data from prying eyes and allows daemons to authenticate each other using SSL certificates.

The Bacula Webmin Module

If your version of Webmin does not include the Bacula Backup System module by default, you will need to install it from either an WBM (Webmin module) or RPM file. This can be done by following these steps :

Go to the Webmin Configuration module, under the Webmin category.

Click on the Webmin Modules icon.

Using the first form on the page, select the WBM or RPM file, and click the Install Module button.

Once installed, the module for managing Bacula can be found in Webmin under the System category. When opened, it will check your system to ensure that Bacula is installed, and that it can connect to the MySQL or PostgreSQL database used for storing backup job information. If any problems are detected, you will need to click on the module configuration link and adjust the database and Bacula file settings.

Once the initial check succeeds, the module will display tables of icons, one for each of the configuration objects that exist on your system. Exactly what appears depends on whether the system has the Bacula director, file or storage daemon installed. Typically this module will be used on a system running the director other other daemons, which is what will be covered in this documentation.

The first three tables of icons are for configuring the Bacula director, storage and file daemons respectively, as indicated by their titles. If your system supports node groups (explained later), the next table will be titled Node Group Configuration. The last table shows icons for performing various Bacula operatings, such as starting backups and showing the status of daemons. Finally, at the bottom of the page are buttons for stopping, starting and restarting the Bacula processes, and for enabling it to start at system boot time.

Creating A New Backup Job

In its default configuration, Bacula comes with two backup jobs that saves source code directory and catalog files. Since you will probably want to backup more important files on your system, the following steps can be used to create an additional job :

Click on the File Sets icon to bring up a list of existing sets.

Click on the Add a new backup file set link.

Enter a unique name into the File set name field, such as MyFiles.

Fill in the Files and directories to backup box with a list of directories that you want to include, one per line.

If there are any files or directories under those set in step 4 that you want to exclude form the backup, list them in the Files and directories to skip text box.

Click the Create button.

Back on the main menu, click on the Backup Jobs icon to bring up a list of existing jobs.

Click on the Add a new backup job link.

On the form that apears, enter a unique name for the job, such as MyFilesJob.

Set the File set to backup to your new file set, and the Backup on schedule field to <Default>. Everythng else can be left unchanged.

Click Create.

Back on the list of jobs, click on the name of the new one to edit it. To start the backup immediately, click on the Run Now icon. A page will appear showing the status of the job as it progresses.

As this example shows, jobs to backup files on the director host can be easily created, edited and deleted through the Webmin user interface. The sections below explain some more complex configurations, such as scheduled and remote backups.

Backing Up On Schedule

Once you have create a backup job and tested it manually, you may want to set it up to run on a regular schedule, such as every day at midnight. To do this, follow these steps :

Click on the Backup Schedules icon to bring up the list of existing schedules.

Click on Add a new backup schedule.

Enter a unique name for the schedule, such as Nightly.

In the Run levels and times table, select a backup level (typically Full) in the first row.

Click on the ... button to the right. This will open a window for selecting exactly when the backup should be run. If you want it to be activated every night, leave All selected in the first four sections, and enter 01 and 00 into the hours and minutes fields near the bottom.

Click the OK button to close the schedule window, and then click Create back in the main window.

Back on the main menu, click on the Backup Jobs icon and then on the name of the job you want to run on schedule.

Change the Backup on schedule field to select your newly created schedule, and click Save.

Once this is done, Bacula will run the job nightly at 1am. If you have created more than one job, the same schedule can be shared by all of them, by selecting it on the Edit Backup Job page in the same way.

Backing Up A Remote Client

Because Bacula is designed as a client-server backup system, it is almost as easy to create a job that backs up another system as it is to create on that runs purely locally. Assuming that you have a remote system that has never been used with Bacula before, the steps to add a backup for for it are :

Install the file daemon only RPM (bacula-client) on the host to be backed up.

Login to Webmin on the remote host, and open the Bacula Backup System module.

Click on the File Daemon Directors icon.

Click on the Add a new director link.

On the page that appears, enter your existing director's name into the Director name field. This is usually it's short hostname followed by -dir , such as fudu-dir.

Choose a random password and enter it into the Accepted password field.

Click Create.

Go back to Webmin on the director system, and click on the Backup Clients icon.This will bring up a list that should initially only contain the director system itself.

Click on Add a new backup client.

Enter the name of the remote client's file daemon into the Client FD name field. This is typically its hostname with -fd appended.

Enter the password you chose in step 6 in the Bacula FD password field.

Enter the client's hostname in the Hostname or IP address field.

All of the other options can be left set to their defaults, so now just click Create.

Once these steps are complete, you can create a new backup job as explained earlier. However, on the job form the Client to backup field should be set to the new client you just created.

Adding A Storage Device

In the default Bacula configuration, the only storage device defined is one that backs up to files in the /tmp directory. This is typically not what you want for real backups, especially if your system has a tape drive attached. To add a new storage device and then setup jobs to use it, follow these steps :

The first part of the process is configuring the storage daemon to add a new backup device. To begin, click on the Storage Devices icon.

Below the list of devices, click on Add a new storage device to create a new one.

In the form that appears, enter a unique name (such as MyTape) into the Storage device name fied.

If you are adding a tape drive, enter its device file (like /dev/st0) in the Archive device or directory field. If adding a directory on the filesystem, enter the directory name (like /backup).

In the Media type name field, enter File for backups to the filesystem, or the tape type (such as DDS-2).

Click the Create button.

After returning to the module's main page, you will need to click on the Restart Bacula button at the bottom. This is necessary because changes to the storage daemon configuration will not be detected without a complete restart.

The second part of the process involves adding the new storage device to the director configuration. To begin, click on the Storage Daemons icon.

Click on Add a new storage daemon below the list of existing daemons known to the director.

Enter a unique name into the Storage daemon name field. This can be the same as what you entered in step 3.

Because you are connecting the director to the local storage daemon, the Bacula SD password, Hostname or IP address and Bacula SD port fields will be filled in automatically and can be left un-changed.

From the Storage device name menu, select the entry named in step 3.

In the Media type name field, you must enter the exact same name as in step 5.

Click the Create button.

Once this process is complete, you can edit an existing backup job (or create a new one), and in the Destination storage device field select the new device. However, before it can be used the new tape or directory must be labelled, as documented in the section below.

Running A Backup Job

The simplest way to run a previously defined backup job is to follow the steps below :

Click on the Run Backup Job icon on the module's main page.

Select the job from the Job to run menu.

If this is a small backup and you want to see its final status, set the Wait for results option to Yes. For longer jobs this should be set to No, as you would have to wait a long time for it to complete.

Click the Backup Now button.

A page will appear showing the Bacula commands used to start the job, and its progress once running if selected. In some cases, Bacula may halt and display a message indicating that the tape or target directory needs to be labelled before it can continue. If this happens, you will need to follow the steps in the next section.

Labelling A Tape Or Directory

Bacula's term for a specific tape or backup file is a Volume. However, before a blank tape or new directory can be used as a volume, it must be labelled – that is, it must be given a unique name. This can be done by following the steps below :

Click on the Label Volume icon on the module's main page, which will open a form for selecting the device to label.

From the Storage daemon to label menu, select the entry that corresponds to the storage deamon and device that contains the tape or directory to label. Generally a directory needs to be labelled only once.

In you have defined multiple backup pools, select the one that this new volume should be added to from the Create in pool menu. Only backup jobs that have this pool specified will use this new volume.

Enter a unique name for the new volume into the New label name field. If the volume is a directory, this will determine the name of the backup file under it.

Click the Label Now button. A page will be displayed showing the output from Bacula as it labels the volume, and any error messages.

Once a volume has been labelled and added to a pool, you can view it using the Volumes In Pool icon. This page can be can also be used to remove a volume from a pool. You should be careful doing this though, as once a volume is removed Bacula will be unable to restore any files from it.

Viewing The Director and Daemon Statuses

Near the bottom of the main page is a line starting with Process statuses that shows the Bacula daemons installed on your system and their current statuses (either Up or Down).

More detailed status information for the director, file and storage daemons can be displayed using the Director Status, Client Status and Storage Daemon Status icons respectively. When clicked, each will display lists of running jobs, recently completed jobs and jobs that are scheduled to be run in the future. If you have multiple clients or storage daemons you will need to select one to display from a menu after clicking on the icon.

If running jobs are displayed, one or more can be cancelled by selecting the checkboxes next to them and clicking the Cancel Jobs button. It may take a few seconds after cancelling a job for it to be removed from the running list and added to the completed list.

Starting And Stopping Bacula

When any Bacula process is running, buttons labelled Restart Bacula and Stop Bacula will be displayed at the bottom of the page. As you might expect these will restart and stop all installed daemons respectively. If any error occurs, an error page will be displayed – otherwise, the module's main page will be re-displayes.

When any Bacula process is stopped, the Start Bacula button will be shown instead. Again, this will attempt to start all daemons, and display an error message if something goes wrong. The most common problem is an error in the configuration file, such as a job that refers to a file set which has been renamed or no longer exists.

If Bacula on your system was installed from an RPM, a button labelled Start At Boot will appear at the very bottom of the page, with Yes and No radio buttons next to it. This can be used to select if the Bacula processes will be started when the system boots up. Generally, this should be set to Yes, otherwise scheduled backups will not run after a reboot.

Restoring A Backup

Once a backup has been made by Bacula, the files within it can be restored at any time. When restoring, you are recovering the files from a particular backup job run, and placing them into a directory on one of the client systems. The steps to do this are :

Click on the Restore Backup icon on the module's main page.

From the Job to restore menu select the particular job run to recover files from. Runs are identified by job name, date and time. If the job run was incremental (containing only changed files since the last run), Bacula will automatically restore files from all required older backups too.

In the Files to restore text box, enter the full paths to the files or directories to recover. You can browse files included in the selected job by clicking the ... button, which will open a popup window for browsing them in a tree view.

From the Restore from storage device menu select the device that has the backup tape or directory to which the data was saved.

From the Restore to client or group menu select the file daemon to which the recovered files should be written. This does not necessarily have to be the same host as the files were originally backed up from.

Enter the directory to which restored files will be written in the Restore to directory field. To put files back exactly where they came from you should enter / in the Other root directory field.

If you want Bacula to display the progress and final status of the restore, the Wait for results field should be set to Yes. For large restores, it is better to set this to No, and monitor the restore on the Director Status page.

Click the Restore Now button. This will bring up a page showing the Bacula commands run to start the restore, and its progress as it runs. In some cases, you may be prompted to load other backup tapes if they contain needed data.

Introduction To Node Groups

Normally, Bacula can only be configured to back up a single client system at a time. However, this Webmin module allows you to define groups of systems that can have the same files sets backed up at once, which can simplify the process of managing large networks. Each system must have the Bacula file daemon installed, and all must be configured to accept the same password from the director. Apart from that, no other special configuration is needed on the client systems in a group.

The systems in a group can come from different sources, chosen on the Module Config page, in the Get node group information from field. By default this is set to Nowhere, indicating that the node group functionality is disabled. However, you can also select from the following options :

Webmin Servers Index module
This standard module allows hosts (typically running Webmin) to be defined and added to multiple groups. When this option is selected, the groups used for Bacula backups will be the same as those set in this module.

OpenCountry database
If your system or another on your network has OpenCountry's OC-Manager product installed, this option can be selected to fetch groups and their members from its database. You must fill in all the options in the OpenCountry node group database settings section with the database type, host, login, password and name in order for Webmin to access it.

Once the node groups feature has been successfully enabled, a new table of icons titled Node Group Configuration will appear on the module's main page. The following sections explain how to use them.

Adding A Node Group

Before members of a node group can be backed up, it must be added to the list of those known to Webmin. The steps to do this are :

Click on the Node Groups icon on the main page.

From the menu next to Add node group, select a group that has not been added yet, and click the Add button.

On the page that appears, fill in the Bacula FD password field with the password that is shared by the file daemon on all group members (shown in the Hosts in node group field). There should be no need to adjust any of the other fields.

Click the Create button. You will be returned to the list of groups, which will include the one you just added.

Once a group has been added, it can be edited or deleted by clicking on it in the list. It can also be used in node group back jobs, as explained in the next section.

Adding A Node Group Backup Job

A standard Bacula job will backup a set of files on only a single system. A node group job can backup a file set on all members of a group, which is very useful if your network has a large number of similar systems. For example, you may want to backup the entire /etc directory on all workstations in an organization.

The steps to add a node group job are :

Click on the Node Group Backup Jobs icon on the module's main page.

Click on the Add a new node group backup job link.

Fill in the form that appears just as you would when creating a normal backup job. The only different field is Node group to backup, which must be set to one of the previously defined groups.

Click the Create button. This will add the jobs, and bring you back to job list.

Running A Node Group Backup Job

Once you have defined at least one node group job, they can be started manually using Webmin. The steps to do this are :

Click on the Run Node Group Backup Job icon on the main page.

Select the job to run from the menu on the form that appears.

Click the Backup Now button.

Because node group jobs are run on multiple systems at once, you cannot wait until they are complete and view their final status. Instead, use the Director Status screen to watch as they progress. Typically, only one client will actually be backed up at a time, as the storage daemon only allows one job to write to a file or tape at once.

Automatic Node Group Synchronization

When a node group or group job is created, Webmin creates hidden entries in the Bacula director configuration file for each member of that group. However, if the group members change in the source database after the job is created, this will not be automatically detected. Fortunately, there is a solution – regular node group synchronization, which can be setup as follows :

Click on the Node Group Synchronization icon on the main page.

Set the Synchronize on schedule option to Yes at times selected below.

Either select Simple schedule and choose Hourly or Daily, or choose a more complex schedule using the minutes, hours, days, months and weekdays lists.

Click the Save button.

Once this is done, all node groups and group jobs will be regularly automatically updated.

Restoring A Backup Job To A Node Group

Once your system has node groups defined, it is possible to restore a backup to not just a single host, but to all members of a group. This can be useful if one or more new clients are added to a network and you want to install initial configuration files on them. The steps to follow are :

Click on the Restore Backup icon.

Select the job to restore, files and storage device just as you would for a normal restore.

In the Restore to client or group field, select the target group under the –Node Groups-- section.

Enter a directory to which the files will be written on all members of group.

Click the Restore button.

On the page that appears the progress of the restore to each client in the group will be shown in turn.

A variant on this kind of restore is recovering the files from a node group backup to the hosts that they were originally backed up from. The steps to do this are :

Click on the Restore Backup icon.

From the Job to restore menu select the job from under the –Node Group Jobs-- section.

Select the files and storage device just as you would for a normal restore.

In the Restore to client or group field, select –All Clients In Group--.

Enter a directory to which the files will be written on all members of group.

Click the Restore button.

On the page that appears the progress of the restore to each client in the group will be shown in turn.

Google Employee

2006-01-09T10:46:57