Entries I can safely exclude doing backups

First off, you should read up a little on rsync's include/exclude syntax. I get the feeling that what you want to do is better done using ** globs than * globs. (** expands to any number of entries, whereas * expands only to a single entry possibly matching multiple directory entries. The details are in man rsync under Include/Exclude Pattern Rules.)

That said, if you want to be able to restore the system to a known working state from the backup with a minimum of hassle, you should be careful with excluding files or directories. I use rsnapshot myself and have actually taken the opposite approach: include everything except for a few carefully selected directories.

So my rsnapshot.conf actually states (with tabs to make rsnapshot's configuration file parser happy):

interval backup NNN # pick your poison
one_fs 0
exclude /backup/**
exclude /dev/**
exclude /proc/**
exclude /run/**
exclude /sys/**
exclude /tmp/**
backup / ./

and very little else. Yes, it means I might copy a bit more than what is strictly needed, but it ensures that anything not intended as ephermal is copied. Because of rsnapshot using rsync's hardlink-to-deduplicate behavior, the only real cost to this is during the first run; after that, assuming you have a reasonably sized (compared to your total data set size) backup target location, it takes very little extra in either time or disk space. I exclude the contents of /backup because that's where I mount the backup target file system; not excluding it would lead to the situation of copying the backup into itself. However, for simplicity if I ever need to restore onto bare metal, I want to keep the mount point!

In my case I also cannot reasonably use one_fs 1; I run ZFS with currently ~40 file systems. Listing all of those explicitly would be a maintenance nightmare and make working with ZFS file systems a lot more involved than it needs to be.

Pretty much anything you want to exclude above and beyond the above is going to depend on the distribution, anyway, so it's virtually impossible to give a generic answer. That said, you're likely to find some candidates under /var.


Most of what you are trying to do can probably be accomplished simply by using the one_fs setting. Set the filesystems you want to include in your backups, then use that setting to ignore the rest (proc, sys, dev, etc.). I'd include /lost+found because that directory should always be empty unless you've backed-up a corrupted filesystem, in which case you probably want a backup of anything that fsck recovered. Also, .pyc and .pyo should not really be in the root directory in the first place, so I'd remove those lines too. /tmp and /var/tmp are about the only remaining paths on a "generic" system which contain data that can be reliably excluded from backups. So maybe try something like:

one_fs 1

exclude /tmp/
exclude /var/tmp/