- Contents
- Introduction
- Requirements
- Build
- Configuration
- Startup
- Testing
- Contact Info
- matt@haught.org
- PGP Public Key
- Wishlist
- MySpace
Bacula for OSX
Introduction
Bacula is a wonderful network backup tool that runs on Microsoft Windows, Linux, FreeBSD, and pretty much any other UNIX or UNIX-like OS, including Darwin, the UNIX under the pretty face of Apple's OSX. This howto shows how to configure a Mac running OS 10.4+ for the Bacula file daemon, bacula-fd, which is the client part of the backup system. The howto assumes that a the server side, bacula-dir & bacula-sd are already setup and working. You can install bacula-fd on OSX 10.3, but starting after booting would be configured differently.
Requirements
The first and most important requirement is to have a working Bacula Director and Storage Daemon running. This how to only covers getting it running on OSX.
To build the file daemon on Mac OSX, the apple Xcode tools are required. The Xcode tools is a package that contains developer tools, and most importantly for building bacula, the gcc compiler. Although you could use Fink to build and install, the file daemon client does not require any of the outside dependencies that fink will try to install and fail like the last time I tried, and you can run the latest version without having to wait for fink to catch up. In the end it is much quicker to just install Xcode and be on your way. The Xcode tools are free, you only have to register with the Apple Developer Connection to download. Other then the Xcode tools, nothing else is needed to build the Bacula file daemon.
Build
As long as only the file daemon is being build, the build will go very smoothly. After downloading and unpacking the Bacula archive, the following configure command is needed.
$ ./configure --prefix=/usr/local --enable-client-only --with-openssl \
--with-working-dir=/var/db/bacula --with-pid-dir=/var/run
This command will configure the build system for OSX. Building bacula statically would be nice, but unfortunately the --enable-static-fd option causes the build to fail. All of the bacula files will be installed in /usr/local with the binaries in /usr/local/sbin and the bacula-fd.conf configuration file in /usr/local/etc. Once the configure script is finished, bacula-fd can be compiled with the following command.
$ make
Things should have compiled smoothly and without error. If successful, Bacula can be installed as root with the following command.
# make install
Configuration
The client bacula configuration for MacOSX is the same as any other client. The configuration will be at /usr/local/etc/bacula-fd.conf. An example of the client configuration is below:
Director {
Name = yourservername-dir
Password = "your client password"
}
FileDaemon {
Name = yourclientname-fd
FDport = 9102
WorkingDirectory = /var/db/bacula
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}
Messages {
Name = Standard
director = yourservername-dir = all, !skipped, !restored
}
The server configuration is also the same as for any other file daemon, but there are a few special considerations for OSX. One is special support for the HFS+ filesystem and excluding user caches and trash in a users home which are both set on the director in the FileSet section. Below is an example of a FileSet section config snippet:
FileSet {
Name = "YouUser Files"
Include {
Options {
signature = MD5
compression = gzip
hfsplussupport = yes
}
File = "/users/youruser"
}
Exclude {
File = "/users/youruser/.Trash"
File = "/users/youruser/Library/Caches"
}
}
Startup
Getting the Bacula file daemon client to start up automatically in OSX is actually pretty easy. OSX looks for special .plist xml files in /Library/LaunchDaemons/ and executes them on startup. For the file daemon, creating the file /Library/LaunchDaemons/bacula-fd.plist containing the following will work.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.bacula.bacula-fd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/bacula-fd</string>
<string>-f</string>
<string>-c</string>
<string>/usr/local/etc/bacula-fd.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
The bacula-fd process can then be loaded by the launchctl load command
$ sudo launchctl load /Library/LaunchDaemons/bacula-fd.plist
Now that it is loaded, bacula-fd will show up in the launchd jobs list. The list can be show using the following command.
$ sudo launchctl list
At the bottom of the list org.bacula.bacula-fd will show up as the job name for bacula-fd. Bacula will now start up automatically when the machine boot. The daemon can be started manually using the following launchctl command. org.bacula.bacula-fd is the label created in the bacula-fd.plist file.
$ sudo launchctl start org.bacula.bacula-fd
