Table of Contents
|
Overview of bacula
Bacula is a set of computer programs that permit you (or the system administrator) to manage backup, recovery, and verification of computer data across a network of computers of different kinds.
Bacula has three components:
- the director daemon, which controls the backup jobs. Only one director is required for an entire network.
- the client daemon, which runs on each host that is backed up.
- the storage daemon, which runs on each host that provides backup storage to tape or disk.
Before you start on the MBWE
Bacula is a sophisticated tool and there are a lot of configuration options. Before installing and configuring bacula on your MBWE, I strongly suggest you:
- install bacula on another host on your network,
- Read The Fine Manual,
- successfully run test backups from one or more clients to this host
You also need to be able to access the MBWE from other hosts by name or IP address. This requires
- a working DNS on your network, or
- static IP addresses and either /etc/hosts files or direct use of IP addresses
bacula on MBWE blue light
compiling bacula
Though bacula package is not included in optware package repository, it is possible to compile it on MBWE by hand. Unfortunately, bacula will not compile nicely with default options. This page will describe how to compile bacula, so this knowledge, acquired in two sleepless nights, will (hopefully) not be lost.
This tutorial assumes you have SSH access to MBWE and have installed optware package manager (ipkg).
First, you have to download bacula sources and install compiler and needed libraries:
ipkg install gcc
ipkg install termcap
ipkg install sqlite
Extract bacula sources to some directory and cd there. Now, to compile bacula, configure sources like this:
LDFLAGS=-L/lib ./configure \
--with-sqlite3=/opt \
--enable-smartalloc \
--disable-conio \
--prefix=/opt/local \
--sysconfdir=/opt/local/etc/bacula \
--with-scriptdir=/opt/local/etc/bacula/scripts
Another trick needed to compile: open src/config.h and REMOVE the following line:
#define HAVE_POSIX_FADVISE 1
After these manipulations, bacula should compile nicely with usual
make
make install
Compilation takes about an hour. After make install bacula binaries will be installed under /opt/local/sbin and configs under /opt/local/etc/bacula. You can use bacula documentation to configure it further.
The final step is to make bacula daemons boot with MBWE. Put this script to /etc/init.d/S80bacula and make it executable:
#!/bin/sh
BACULA_HOME=/opt/local
case "$1" in
start)
echo Starting bacula-dir
$BACULA_HOME/sbin/bacula-dir
echo Starting bacula-sd
$BACULA_HOME/sbin/bacula-sd
echo Starting bacula-fd
$BACULA_HOME/sbin/bacula-fd
;;
stop)
killall bacula-sd
killall bacula-fd
killall bacula-dir
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
Of course, you can remove daemons you don't want to start from your script.
Happy backuping,
Andrey Lebedev.
bacula on MBWE white light
bacula is available from optware for the cs05q1armel platform, which is currently used for the MBWE white light. At present (2009-06-18) there are some problems with this port, and some parts don't work. It is, however, possible to run the bacula storage daemon and this allows us to store backups on the MBWE.
installing bacula on MBWE white light
We assume you have enabled SSH access to MBWE and have installed the optware package manager (ipkg).
Log on as root to the MBWE using ssh and install bacula using ipkg.
ipkg install bacula
configuring bacula
The bacula package is built with —prefix=/opt and is configured to use the sqlite3 database. The files of interest to us are:
- the executables:
- /opt/sbin/bacula-dir, the director daemon
- /opt/sbin/bacula-fd, the client daemon
- /opt/sbin/bacula-sd, the storage daemon
- /opt/sbin/bconsole, the bacula console
- the configuration files
- /opt/etc/bacula/bacula-dir.conf, the director configuration file
- /opt/etc/bacula/bacula-fd.conf, the client configuration file
- /opt/etc/bacula/bacula-sd.conf, the storage configuration file
- /opt/etc/bacula/bconsole.conf, the console configuration file
- the scripts in /opt/etc/bacula/scripts
- the files in /opt/var/bacula/working
Create the database
Run the script /opt/etc/bacula/scripts/create_bacula_database. This will stop complaints from bacula-dir.
The configuration files
Global changes
The bacula package uses localhost in the configuration files. We will save a copy of the original files and change localhost to mbwe globally using sed.
cd /opt/etc/bacula/
cp bacula-dir.conf bacula-dir.conf.orig
cp bacula-fd.conf bacula-fd.conf.orig
cp bacula-sd.conf bacula-sd.conf.orig
cp bconsole.conf bconsole.conf.orig
sed -i -e 's/localhost/mbwe/g' bacula-dir.conf
sed -i -e 's/localhost/mbwe/g' bacula-fd.conf
sed -i -e 's/localhost/mbwe/g' bacula-sd.conf
sed -i -e 's/localhost/mbwe/g' bconsole.conf
Configuring the storage daemon
We will use the MBWE as a file storage device, and will store the backup files in /DataVolume/bacula.
Create the storage directory.
mkdir /DataVolume/bacula
Edit bacula-sd.conf, find the Device with Name = FileStorage, add the storage directory name to the Archive Device line and change the Media Type from the default File to a unique label, such as File-a1. This stanza should read
Device {
Name = FileStorage
Media Type = File-a # A unique label shared with one client
Archive Device = /DataVolume/bacula
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
You can delete the other Device stanzas from bacula-sd.conf if you wish, as the MBWE does not support tape drives, DVD drives, etc. They do no harm, but add to the clutter.
Configuring the client daemon
TBA.
Local testing
Start the three daemons
/opt/sbin/bacula-dir -c /opt/etc/bacula/bacula-dir.conf
/opt/sbin/bacula-sd -c /opt/etc/bacula/bacula-sd.conf
/opt/sbin/bacula-fd -c /opt/etc/bacula/bacula-fd.conf
You can now start bconsole and interrogate the daemons. For example
bconsole
status director=mbwe-dir
status client=mbwe-fd
status storage=mbwe-sd
Unfortunately there are problems with (at least) the bacula-dir. Various commands will hang and the only solution seems to be killing bconsole with ^C and the various daemons with kill or killall.
Remote access
Don't despair. Bacula is a network backup solution and we can run the client and storage daemons from a director running on another host. Fortunately (see above) you already have bacula running on a remote host named other.
Configuring the storage daemon
To allow remote access to the storage daemon, we add the following to the following section to the bacula-dir.conf on the remote host other.
Storage {
Name = mbwe-file
Address = 192.168.1.2 # hostname or IP address of mbwe
SDPort = 9103
Password = "aaa-password" # password shared with MBWE bacula-sd and other bacula-dir
Device = FileStorage
Media Type = File-a # The unique label shared with the MBWE bacula-sd
}
and this section to the bacula-sd.conf file on the MBWE
Director {
Name = other-dir # name of the remote director daemon
Password = "aaa-password" # password shared with MBWE bacula-sd and other bacula-dir
}
After restarting both daemons, the bacula-dir (and bconsole) on other will be able to access and use the MBWE storage daemon. This will allow the remote director to use the MBWE as a backup device for any device on the network.
Configuring the client daemon
The MBWE client daemon can be configured similarly, which allows the MBWE to be backed up. I haven't done this.
Startup script
The sample startup scripts /opt/etc/bacula/scripts/bacula-ctl-dir, /opt/etc/bacula/scripts/bacula-ctl-fd and /opt/etc/bacula/scripts/bacula-ctl-sd don't work. The script in the MBWE blue light section (above) will work with the change BACULA_HOME=/opt.
Problems
As mentioned above, I have experienced various hangs with bacula on the MBWE. Starting each of the daemons with the "-d 100" flag - which sends debugging messages to stdout - I have seen the following message:
/opt/sbin/bacula-dir: relocation error: /opt/sbin/bacula-dir: symbol __pthread_register_cancel, version GLIBC_2.4 not defined in file libpthread.so.0 with link time reference
This indicates differences between the optware cs05q1armel platform and the MBWE white light system libraries. This may require a rebuild with a proper WD MBWE white light toolchain.
David Billinghurst