BackupPC – excluding files (and directories)

BackupPC is a great piece of software: It’s simple, it builds on top of common tools and protocols, it’s cross-platform, it’s space-efficient, it provides a number of different options when it comes to restoring data, and it comes with a web interface.

Scenario

If disk space, bandwidth, and time permits — backing up a server’s complete filesystem, and then explicitly excluding certain files and directories (e.g. /proc, /sys, /bin, /lib, …) — will help to minimise the likelihood of not backing up an important file (which, for whatever reason, happened to make its way to a location which isn’t backed up).

BackupPC allows you to implement this backup strategy, relatively easily.

For the sake of simplicity, in this scenario, our goal is to backup the /var directory, but to exclude the /var/run subdirectory.

The Issue

BackupPC allows you to exclude files. However, it may not be immediately obvious how to use this feature.

If you wish to back up /var, and exclude /var/run, the following will not work:

BackupPC - Exclude Files - Correct

The Solution

The solution is to to create a BackupFilesExclude entry, with a key that has the same name as the Share (i.e. /var) you wish you exclude the file from. Once the key has been created, the next step is to Insert the file you do not wish to back up. IMPORTANT NOTE: The exclude file value may be interpreted differently, depending on the type of XferMethod used (e.g. tar, rsync, smb, etc.) — refer to the documentation. In this particular case (from the documentation): “For tar, if the exclude file contains a “/” it is assumed to be anchored at the start of the string.”

The solution looks something like this:

BackupPC - Exclude Files - Incorrect