Bacula on Mac OS X

I’ve been experimenting with the Open Source backup system ‘Bacula‘, which is gaining popularity as an alternative to the venerable Amanda.

I wanted to use my Linux machine to backup our two Macs, so I needed a version of the Bacula agent bacula-fd which was built for Mac OS X. That turned out to be pretty easy to do, but since I’ve had an amazing number of visitors to the post where I made a copy of ‘wget’ available, I thought I’d put this up here too in case anyone else is looking for it.

So here is a gzipped tar file containing the basics. Note that this doesn’t contain any of the other bits of Bacula, only the file daemon that you’ll need if you want to back your Mac up over the network from elsewhere. I haven’t done extensive testing, but it seems to be working OK. This is from Bacula 1.38.2, and was built on Mac OS X 10.4.3.

Some quick notes on how to use it:

The path names here can be changed if you edit the appropriate config files – these are just the ones I used.

  1. Copy bacula-fd to /usr/local/sbin (creating the directory if necessary)
  2. Edit bacula-fd.conf to your requirements. See the Bacula website for docs if you don’t know how to do this.
  3. Copy bacula-fd.conf to /usr/local/etc (again, creating the directory if necessary).
  4. Set the permissions so that bacula-fd.conf is not generally readable.
  5. Create the directory /var/bacula/working as a working directory.
  6. You probably want hfsplussupport = yes in the Options bit of the FileSet declaration on the server.
  7. You can now test it from the command line with
    sudo /usr/local/sbin/bacula-fd -c /usr/local/etc/bacula-fd.conf
    Add -f and -d100 if you want it to stay in the foreground and print debugging info.
  8. On Tiger, the right way to start things on boot-up is to use launchd. Copy bacula-fd.plist to /Library/LaunchDaemons (editing it if you’ve used any different paths).
  9. You can use sudo launchctl load /Library/LaunchDaemons/bacula-fd.plist to load it into your currently-running launchd. You should then be able to see it with
    sudo launchctl list.
  10. Assuming that worked OK, you can start the daemon running with
    sudo launchctl start org.bacula.bacula-fd.

Enjoyed this post? Why not sign up to receive Status-Q in your inbox?

13 Comments

Would it be possible for you to post a quick summary of the steps you had to take to get just the bacula-fd daemon compiled statically? I’m new to the OS X universe, and so I really have no idea what sort of dependencies and such I have to take into account when making a binary.

Hi Adam –

Actually, if memory serves, I think it was pretty simple – there aren’t many dependencies here because the File Daemon bit is pretty straightforward. I’m not sure how familiar you are with the basic process – so apologies if this is all obvious – but assuming you’ve got a recent version of the Apple Developer Tools installed, you should just be able to download the bacula source, unpack it in a directory, change into that directory and run:

./configure --enable-client-only 
make all

You can see the options to any given ‘configure’ by running it with a ‘–help’ argument. This particular one supports ‘–enable-client-only’ which tells it not to build most of the stuff that’s likely to be on a server – the director, storage daemon etc. They do have rather more dependencies on things like MySQL, so would be more challenging.

Normally, I then run:

make -n install

which does a dry-run of the installation, and lets me see where things are likely to be installed. In my case, I wanted to tweak some of these, so my eventual build and install was:

make clean
./configure --enable-client-only --prefix=/usr/local --with-working-dir=/var/bacula/working
make all
sudo make install

On most versions of Unix I would use the ldd bacula-fd command to ‘list dynamic dependencies’. On the Mac, the equivalent is otool -L bacula-fd. In this case, there are very few and they look like standard system libraries, so I was happy distributing it as it stands. I’m not sure whether the configure script arranged for anything else to be statically linked, or whether the file daemon just doesn’t need much more than this!

Thanks! I’ll definitely give this a shot.

The main part I was missing was the “–enable-client-only” flag, without which it was indeed a much more challenging build. 🙂

It is also handy to know how to get at the dependencies of a file on the Mac. Is “otool” an Apple-specific addition, or is that how FreeBSD in general handles that job?

Update: I’ve realised that the .plist file should go in /Library/LaunchDaemons rather than /Library/LaunchAgents, because it needs to run as root. I’ve updated the instructions above.

Another way to manage your launchctl setup is using the utility called Lingon.

Thanks so much for this! It’s simplified by life! Works like a charm!

This seems to work perfectly. I tried installing bacula from Fink, but Fink has version 1.36, and I was getting some errors that I think can be blamed on the version mismatch. I’m crossing my fingers on this version…

Also, I like the tagline for your blog :).

For those interested, I packaged these files up as proper OS X installers. It makes things a bit easier, as the installer will make the necessary directories, run the launchctl scripts, etc. However, you’ll still have to edit the config files by hand. The easiest way to get those changes to apply would be to restart the Mac. (The installer starts the client after installation and on subsequent reboots.)

Because I’ve used launchctl, these installers will only work properly in 10.4 Tiger and newer. I’ve made installers for both PPC Macs and Intel.

http://www.joerhodes.com/Bacula_X_Installers.dmg

It would be nice if we could make an AppleScript that would ask the user for the hostname, director’s name, and password. Then we wouldn’t have to edit the config file at all. Alas, I’m just not that smart. (Yet….)

Any chance of a package installer for the server/controller portion of Bacula?

Does the installer enable compression for the Bacula FD? My backup logs say that compression is not turned on and I’m trying to track down why.

What about for bacula 2.2.4 will the .dmg or these instructions still work?

i had a problem with the conection, the director keeps waiting conection to the mac filedaemon how can i perhaps tath the filedaemon is actually working ok, i mean in windows is like the filedaemon has a tray monitoring tool or someting like tath tath tells you when the director is conected to the client is there any tool like this for mac os ?

I’ve just finished setting up bacula on ubuntu 17 for server and a verity of machines including Apple Sierra. download the latest 9.0.3 source and move into the platforms/osx directory and read the readme – it compiled first time and i even managed to change the compile to include a console for OSX/Sierra.

Got Something To Say:

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

*

© Copyright Quentin Stafford-Fraser