User Tools

Site Tools


FreeBSD Bacula Disaster Preparedness & Planning

Create Static Bacula FD (<bacula-3.x.x)

The Bacula FD daemon in the FreeBSD port is compiled dynamically– not statically. This means that during a restore of a client, the FD daemon may be missing several libraries or may fail due to incompatible versions of libraries. To check for dependency on libraries, one needs to run the 'ldd' command followed by the name of the file. Thus checking for libraries needed by /usr/local/sbin/bacula-fd would be as follows:

 root@pisces:/root# ldd /usr/local/sbin/bacula-fd
 /usr/local/sbin/bacula-fd: => /lib/ (0x280c6000) => /lib/ (0x280d8000) => /usr/local/lib/ (0x280ea000) => /usr/lib/ (0x280f3000) => /usr/local/lib/ (0x280fa000) => /usr/lib/ (0x281ef000) => /lib/ (0x2822f000) => /usr/lib/ (0x2837e000) => /lib/ (0x2846d000) => /lib/ (0x28482000) => /lib/ (0x2848c000)

This shows that the bacula-fd needs these 11 libraries! Thus it is essential to create a statically linked FD file for the purpose of restoring in order to reduce issues with missing or incompatible libraries. In this section, I will explain how to go about creating such a file.

One way would be to use the CONFIGURE_ARGS environment variable. Here's an example for csh/tcsh:

 cd /usr/ports/sysutils/bacula-client
 env CONFIGURE_ARGS+=--enable-static-fd make

Another way would be to make the option persistent by adding into /etc/make.conf the following lines:

 .if $(.CURDIR:M*/sysutils/bacula-client) || \

I put the persistent option lines into the /etc/make.conf file for all of my bacula clients (version 2.4.4) and did the following:

 root@pisces:/usr/ports/sysutils/bacula-client# make config
 root@pisces:/usr/ports/sysutils/bacula-client# make install

After executing the above commands, I now have a file called static-bacula-fd in /usr/ports/sysutils/bacula-client/work/bacula-2.4.4/src/filed. The size is, in most cases, more than twice as big as the dynamically linked bacula-fd.

Next, I checked to see which libraries, if any, were needed by static-bacula-fd:

 root@pisces:/usr/ports/sysutils/bacula-client/work/bacula-2.4.4/src/filed# ldd static-bacula-fd
 /usr/ports/sysutils/bacula-client/work/bacula-2.4.4/src/filed/static-bacula-fd: => /usr/local/lib/ (0x280ea000) => /usr/local/lib/ (0x280fa000)

So by having a statically linked bacula-fd file, we have managed to cut down the number of libraries from 11 to 2! However, during a trial restore run, I noticed that the library needed the /lib/ library so we will need to include that library in addition to the two libraries above.

So the following is a list of files are what is needed for a full bare mental restore which is covered in the next section:


One should copy these files to a safe and secure place– preferably off-site. Or into a backup bag that is taken off-site during non-business hours. All of the files and system configuration information should be copied to a ftp server prior to the restore process.

Create Static Bacula FD (Bacula 3.x.x)

For bacula 3.x.x the procedure for building a static bacula file daemon is slightly different.

First edit /etc/make.conf and add the following(–disable-libtool is now needed to compile a static binary):

 .if $(.CURDIR:M*/sysutils/bacula-client) || \

Now configure and compile:

 cd /usr/ports/sysutils/bacula-client
 make config

(In make config you select the SFDAEMON.)


In /usr/ports/sysutils/bacula-client/work/bacula-3.x.x/src/filed you will find static-bacula-fd.

To check if you correctly compiled the binary execute this command:

 file static-bacula-fd

In the output you should find “statically linked”:

 static-bacula-fd: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), for FreeBSD 7.2, statically linked, FreeBSD-style, stripped

System Configuration Information

In order to prepare a system for restoration, one needs to know how the previous system was configured. Thus it is critical to keep records of such information handy during restoration. Thus the following information should be copied and stored off-site in a safe and secure place:

 part_table_adxs1x         # copy partition info for each hard drive in system-- i.e. ad0, ad2, etc.

This information can be found in /root/sysinfo and is created by running /root/bin/ During the restore process, you will need all or most of information above in order to restore the system to its backed up state. Content of as follows:

 # create collection of system information
 # for restore purposes
 ifconfig > /root/sysinfo/nic_settings 
 netstat -rn > /root/sysinfo/gateway
 cp /etc/resolv.conf /root/sysinfo/resolv.conf
 df -h > /root/sysinfo/disk_usage
 swapinfo > /root/sysinfo/swap_usage
 # modify all of the statements below for each system's drives
 # do 'df' to find drive pathname prior to editing
 disklabel da0s1 > /root/sysinfo/part_table_da0s1
 disklabel da1s1 > /root/sysinfo/part_table_da1s1
 disklabel da2s1 > /root/sysinfo/part_table_da2s1
 # end of

All of the files and system configuration information should be put on a ftp server or portable media prior to the restore process.


In addition, as part of the restore process, the chroot command is used. Thus we need to know if the chroot command has any libraries that it needs:

 root@pisces:/root# ldd /usr/sbin/chroot
 /usr/sbin/chroot: => /lib/ (0x2807b000)

Note: the chroot command requires the /lib/ which is also needed by bacula-fd.

All of the files and system configuration information should be put on a ftp server prior to the restore process.

Storing Critical Data Off-Site

In the backup tapes bag, be sure to have the following for all FreeBSD systems:


Also have the following system configuration information for each FreeBSD client:

 part_table_adxs1x         # copy partition info for each hard drive in system-- i.e. ad0, ad2, etc.

In addition, be sure to have a FreeBSD Install Disk #1 and FreeBSD LiveCD CD-ROMs handy!

Finally, if there has been any changes made to the system configurations– i.e. adding an additional hard disk or swapping out a NIC for a newer NIC, be sure to update the system configuration information! Also if the port version of the Bacula client has changed, to copy again the static-bacula-fd and it's libraries to the off-site location.

Doug Sampson 2009/03/10 13:44

freebsd_disaster_preparedness_planning.txt · Last modified: 2010/01/14 12:29 by deadeyes