Now that we have installed both of our applications, it’s time to start learning about some of the basic features of Bacula so that we can start using Webacula. Let’s start out with learning a bit more about the three main services responsible for running Bacula.
Bacula Services
Bacula Director
Bacula director or bacula-dir is the service responsible for monitoring, recovering and verifying backups. The backup director configuration file /etc/bacula/bacula-sd.conf contains the Job information which will be used to schedule jobs.
Bacula File Daemon
Bacula File Daemon or bacula-fd is the service responsible for reading, writing and verifying files which are being backed up to another directory over the network. Each client that is being backed up will need to have the Bacula file daemon installed.
Bacula Storage Daemon
Bacula Storage Daemon or bacula-sd is the service which controls the storage devices which the data will be backed up to. The /etc/bacula/bacula-sd.conf configuration file is used for specifying what type of media you are backing up your data to and how it is going to be backed up.
Bacula Console
The Bacula console or bconsole, although not a service, is an important application used for relaying information between the Bacula console and Bacula director. In this tutorial we will be using the Bacula console through the Webacula interface.
Backup levels
Almost with every other program used to backup data, there are three main types of backup levels. When adding your jobs to the Bacula director, Bacula allows you to set your backup level to one of three levels.
Full backup
A full backup is as the name suggests a complete backup of all the contents on the specified drive or directory. Full backups are typically the least efficient of all the backups and require the largest amount of disk space.
Incremental
An incremental backup is a backup which allows you to backup only the files which have been modified sine the last backup.
Differential
A differential backup is a backup which only backs up the files which have modified since the last full backup.
Scheduling your first job
Now that you know a bit more about Bacula, some of the features of Webacula will now be easier for us to learn to use. When first installing Bacula, two backups will be scheduled by default: these are BackupClient1 and BackupCatalog. The client is the machine which has bacula-fd installed on it, which in this case is the machine we are using. The catalog is a list of all the files and details about each file stored in the database, the catalog keeps track of size and modification date in order to indentify if a file needs to be backed up again if you’re using a incremental or differential backup.
For this tutorial we will just be doing a simple backup of the client to the /backup folder which we setup earlier during the installation. So let’s open up our bacula-dirs.conf file and take a look a closer look at our default jobs.
We can skip the Director section at this stage and move directly onto the JobDefs section. The JobDefs section defines how each job will run, you can create multiple JobDefs or you can just stick with the default one. In this case we will use the default JobDefs, but you should copy and paste the block of code and comment out of the second block so that you have a reference incase you make a mistake or want to revert back.
JobDefs { Name = "DefaultJob" Type = Backup Level = Incremental Client = bacula-fd FileSet = "Full Set" Schedule = "WeeklyCycle" Storage = File Messages = Standard Pool = Default Priority = 10 }
Let’s say for this tutorial that we want an incremental backup of all text files on our client inside the /var/www/html directory to be performed once weekly. Taking a look at our default job definition we can see that the level is already incremental, but our FileSet is set to Full Set. The Full Set is a backup of all the files on the client inside the /usr/sbin directory, which is not what we want. If we take a look below we can see our default FileSet, so let’s copy and paste this file set and create a new one with a few different values.
FileSet { Name = "Full Set" Include { Options { signature = MD5 } File = /usr/sbin } Exclude { File = /var/spool/bacula File = /tmp File = /proc File = /tmp File = /.journal File = /.fsck } }
The first thing we want to do is modify the name of the file set to something suitable such as Apache Text, we also need to modify the File directory to /var/www/html. Next we need to add a few extra lines to Include {} which tells Bacula that we only want to include text files. We can do this by adding wildfile = “*.txt”. It should look something like this when you’re done.
FileSet { Name = "Apache Text" Include { Options { signature = MD5 wildfile = "*.txt" } File = /var/www/html } }
Now we will need to go back to the JobDefs section and modify the following lines to suit our example backup scenario.
JobDefs { Name = "Apache" Type = Backup Level = Incremental Client = bacula-fd FileSet = "Apache Text" Schedule = "WeeklyCycle" Storage = File Messages = Standard Pool = Default Priority = 10 }
Next we need to create the job, give it a new name and tell it which JobDefs to read. It’s also a good idea to give the bootstrap a new name in case you want to run multiple jobs. The bootstrap file contains statistical information about what files are to be restored and can be read through a text editor once created.
Job { Name = "BackupApacheText" JobDefs = "Apache" Write Bootstrap = "/var/spool/bacula/Apache.bsr" }
Once you have finished writing to bacula-dirs.conf, be sure to save the file and restart the bacula director service using “service bacula-dir restart” and your job will now be setup.
Monitoring your jobs
You can now start using Webacula to monitor and view running jobs, storage and client information. Using your browser, open up http://localhost/webacula and browse to the job section. From here you will be able to force your job to start, restore your last backup or view errors which have happened during your backup. If you click on run under jobs you will be able to schedule a time for your job to run.
Before you run your first job you will need to go into the Bacula Console under desktop or bconsole from the terminal and create a label for your new volume. Simply typing in label, giving it a name and putting it in the default pool will be enough to allow you to run your first job. You can modify details about the volume later on through the Bacula console or through the Pool/Volume section of Webacula.
The first time you run your job, the backup will be a full backup, so depending on how many files you have means it may take longer. However, any additional backups you run will be incremental, so you can expect the incremental backups to be a lot quicker.