|
|
|
# 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:
|
|
|
|
libz.so.4 => /lib/libz.so.4 (0x280c6000)
|
|
|
|
libthr.so.3 => /lib/libthr.so.3 (0x280d8000)
|
|
|
|
libintl.so.8 => /usr/local/lib/libintl.so.8 (0x280ea000)
|
|
|
|
libwrap.so.5 => /usr/lib/libwrap.so.5 (0x280f3000)
|
|
|
|
libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x280fa000)
|
|
|
|
libssl.so.5 => /usr/lib/libssl.so.5 (0x281ef000)
|
|
|
|
libcrypto.so.5 => /lib/libcrypto.so.5 (0x2822f000)
|
|
|
|
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x2837e000)
|
|
|
|
libm.so.5 => /lib/libm.so.5 (0x2846d000)
|
|
|
|
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x28482000)
|
|
|
|
libc.so.7 => /lib/libc.so.7 (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) || \
|
|
|
|
$(.CURDIR:M*/sysutils/bacula-client)
|
|
|
|
CONFIGURE_ARGS+=--enable-static-fd
|
|
|
|
.endif
|
|
|
|
|
|
|
|
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:
|
|
|
|
libintl.so.8 => /usr/local/lib/libintl.so.8 (0x280ea000)
|
|
|
|
libiconv.so.3 => /usr/local/lib/libiconv.so.3 (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 libintl.so.8 library needed the
|
|
|
|
/lib/libc.so.7 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:
|
|
|
|
|
|
|
|
/usr/local/etc/bacula-fd.conf
|
|
|
|
/usr/ports/sysutils/bacula-client/work/bacula-2.4.4/src/filed/static-bacula-fd
|
|
|
|
/usr/local/lib/libintl.so.8
|
|
|
|
/usr/local/lib/libiconv.so.3
|
|
|
|
/lib/libc.so.7
|
|
|
|
|
|
|
|
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) || \
|
|
|
|
$(.CURDIR:M*/sysutils/bacula-client)
|
|
|
|
CONFIGURE_ARGS+=--disable-libtool
|
|
|
|
.endif
|
|
|
|
|
|
|
|
Now configure and compile:
|
|
|
|
|
|
|
|
cd /usr/ports/sysutils/bacula-client
|
|
|
|
make config
|
|
|
|
|
|
|
|
(In make config you select the SFDAEMON.)
|
|
|
|
|
|
|
|
make
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
disk_usage
|
|
|
|
swap_usage
|
|
|
|
nic-settings
|
|
|
|
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/collect_sys_info.sh. 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 collect_sys_info.sh as follows:
|
|
|
|
|
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# 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 collect_sys_info.sh
|
|
|
|
|
|
|
|
All of the files and system configuration information should be put on a
|
|
|
|
ftp server or portable media prior to the restore process.
|
|
|
|
|
|
|
|
## chroot
|
|
|
|
|
|
|
|
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:
|
|
|
|
libc.so.7 => /lib/libc.so.7 (0x2807b000)
|
|
|
|
|
|
|
|
Note: the chroot command requires the /lib/libc.so.7 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:
|
|
|
|
|
|
|
|
/usr/local/etc/bacula-fd.conf
|
|
|
|
/usr/ports/sysutils/bacula-client/work/bacula-2.4.4/src/filed/static-bacula-fd
|
|
|
|
/usr/local/lib/libintl.so.8
|
|
|
|
/usr/local/lib/libiconv.so.3
|
|
|
|
/lib/libc.so.7
|
|
|
|
|
|
|
|
Also have the following system configuration information for each
|
|
|
|
FreeBSD client:
|
|
|
|
|
|
|
|
disk_usage
|
|
|
|
swap_usage
|
|
|
|
nic-settings
|
|
|
|
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](dougs@dawnsign.com) 2009/03/10 13:44* |