Sat, 02 Nov 2013

Use Separate State Directory for Burp

I recently bought a RAID enclosure for my backup drives. One of the nice features is that it powers down the drives and fans when there is no activity for five minutes.

I use burp for backing up my laptops. Burp has a timed backup mode, in which a client can connect to the server, and start a backup if it's been too long since its last backup. This allows, for example, wife to suspend her laptop whenever she wants. When it is running, burp will check with the server every 20 minutes whether it needs to be backed up. If she suspends it in the middle of a backup, it will resume during the next check.

I've configured burp to only allow backups outside of my normal working hours so I don't need to hear the drives grinding away while I'm at my desk. (Pulling myself away from my desk at night is the next challenge.)

The only problem with this configuration is that when a client connects, the backup directory is accessed to figure out whether to start a backup, causing the drives in my RAID enclosure to spin up. The solution was to not have burp touch the backup directory until it's starting a backup.

When a client connects, burp creates a lockfile. By default, this lockfile is created in the backup directory, but there is an option to use a different directory, client_lockdir. Set this in the server's burp.conf.

client_lockdir=/var/run/burp

The next change required is to have the timer script, which checks whether the server should start a backup when the client asks, use a separate directory to check the state of existing backups. First, enough data from the backup directory needs to be copied to a separate directory each time a backup is completed. To do this, I use the server_script_post option, which runs a script each time a backup completes.

server_script_post=/etc/burp/update_state_dir

My update_state_dir script copies the current symlinks and timestamp files from the backup directory to a separate state directory. I updated the timer script to check this state directory. Review all of the changes at github.

tech | Comments | Permanent Link

The state is that great fiction by which everyone tries to live at the expense of everyone else. - Frederic Bastiat