Bacula |
# director status, current and recent jobs and status status dir # start a backup job run # see recent messages messages # begin a restore restore
# estimate size estimate job=job-name # get list of all changed files that will be backed up @output /tmp/listing estimate job=job-name listing level=Incremental @output
# listing files in most recent backup @output /tmp/listing list files jobid=<id> @output
You can do pretty much anything with filesets. Here's an example I was using for one of my jails that includes everything in /, then excludes some wildcard filesets and also some specific directories.
FileSet { Name = "Geektank Full Set" Include { Options { signature = MD5 } Options { Exclude = yes wildFile = "*/spam/*" wildFile = "*/tmp/*" } File = / } Exclude { File = /mnt File = /proc File = /dev File = /rescue File = /tmp File = /spam File = /usr/ports } }
/usr/local/etc/rc.d/z-bacula.sh stop rm /var/db/bacula/* rm /export/wh01/backups/* /usr/local/share/bacula/make_sqlite3_tables /usr/local/etc/rc.d/z-bacula.sh start chmod g+w /var/db/bacula/bacula.db bconsole
This is pretty useful for testing when first setting up bacula-dir.
# start bconsole and determine media for this host media list # for each VolumeName in this server's pool delete media volume=hostname-full-0001 # remove physical files from the filesystem rm /export/wh01/backups/hostname-* # restart the job for this hostname in bconsole run hostname
I installed the bacula client (bacula-fd) from fink. Since I run the bacula server on FreeBSD and the FreeBSD port is newer than the fink port, I then downloaded the source and compiled and installed it in /usr/local/bin.
I use launchd to start up bacula-fd as root. I use Lingon to build and manage my launchd config files. Here is my user daemon config file.
<?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>bacula-fd</string> <key>ProgramArguments</key> <array> <string>/usr/local/sbin/bacula-fd</string> <string>-c</string> <string>/sw/etc/bacula/bacula-fd.conf</string> </array> <key>RunAtLoad</key> <true/> <key>ServiceDescription</key> <string>bacula-fd</string> </dict> </plist>
btw, don't forget to open port 9102 on your firewall: System Preferences > Sharing
I use a large hard drive for all my backups instead of a tape drive, because I want every system to get backed up every day, and I don't want to spend the rest of my life changing tapes.
Here's what I define in bacula-dir on the backup server for each client. I simply search/replace 'hostname', update the file daemon password, and tweak the FileSet as necessary.
# #_* Hostname # JobDefs { Name = "HostnameJob" Type = Backup Level = Incremental FileSet = "Hostname Full Set" Schedule = "WeeklyCycle" Storage = File Messages = Standard Priority = 10 } Job { Name = "hostname" JobDefs = "HostnameJob" Client = hostname-fd Pool = Default Full Backup Pool = hostname-full-pool Incremental Backup Pool = hostname-inc-pool Differential Backup Pool = hostname-diff-pool Write Bootstrap = "/var/db/bacula/hostname.bsr" } Client { Name = hostname-fd Address = hostname.subaudi.net FDPort = 9102 Catalog = MyCatalog Password = "really_long_secret_password" # password for FileDaemon File Retention = 30 days # 30 days Job Retention = 6 months # six months AutoPrune = yes # Prune expired Jobs/Files } Pool { Name = hostname-full-pool Pool Type = Backup Recycle = yes # automatically recycle Volumes AutoPrune = yes # Prune expired volumes Volume Retention = 6 months Accept Any Volume = yes # write on any volume in the pool Maximum Volume Jobs = 1 Label Format = hostname-full- Maximum Volumes = 6 } Pool { Name = hostname-inc-pool Pool Type = Backup Recycle = yes # automatically recycle Volumes AutoPrune = yes # Prune expired volumes Volume Retention = 20 days Accept Any Volume = yes Maximum Volume Jobs = 6 Label Format = hostname-inc- Maximum Volumes = 5 } Pool { Name = hostname-diff-pool Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 40 days Accept Any Volume = yes Maximum Volume Jobs = 1 Label Format = hostname-diff- Maximum Volumes = 6 } FileSet { Name = "Hostname Full Set" Include { Options { signature = MD5 } File = /path/to/backup File = /another/path } Exclude { File = .Spotlight-V100 File = .Trashes } }
Today I installed the bacula-server port on my FreeBSD box. I chose sqlite3 support, and I created the sqlite database. Then I tried to start up bacula using: sudo /usr/local/etc/rc.d/z-bacula.sh start
After that, I tried running bconsole, but was getting a timeout trying to connect:
$ bconsole Connecting to Director vicious:9101 13-Mar 17:57 bconsole: Fatal error: bnet.c:859 Unable to connect to Director daemon on vicious:9101. ERR=Connection refused
So I checked what ports bacula was using:
sockstat | grep bacula root bacula-fd 25096 3 tcp4 *:9102 *:* bacula bacula-sd 25093 3 tcp4 *:9103 *:*
Hmm, bacula-dir should be running on 9101.... I tried to start bacula-dir manually, using debug output, to see if I could see some sort of error message:
sudo /usr/local/sbin/bacula-dir -v -d 5 -u bacula -g bacula -v -c /usr/local/etc/bacula-dir.conf bacula-dir: dird.c:128 Debug level = 5 Fatal error 'mutex is on list' at line 540 in file /usr/src/lib/libpthread/thread/thr_mutex.c (errno = 2)-
Hmm, a problem in the threading... I recalled that I built sqlite3 with thread support, so perhaps that was the problem... If so, then I could either try to re-build sqlite3 without threading support or else use the default sqlite2. If threading was really somehow messed up in sqlite3, then that seemed like the best place to start. So I removed the sqlite3 port and re-installed without enabling thread support.
cd /usr/ports/databases/sqlite3 # remove the installed port sudo make deinstall # remove cached options for port so I can rebuild without threading enabled rm -rf /var/db/ports/sqlite # re-install sudo make all install
Then I stopped the daemon and then started it back up and all appears to be working great now, so I'm back to reading the brief tutorial. I'm not sure what's up with the sqlite3 threading, but I'll leave that for another time since my top priority is getting bacula up and running.