What Folders Should I Not Backup on CentOS?

I'm using rsnapshot to start backing up a CentOS 5.5 install and I need a list of folders that I should probably exclude from the backups. The server is primarily a LAMP web server, and will be serving at the time of the backup, though should be relatively low volume. Is backing up /var/lib/mysql a bad idea?

I'm assuming I should not worry about backing up /proc, what other folders don't need to be backed up?


You can almost certainly ignore /proc, /dev, /tmp and /var/tmp.

A good case can be made for ignoring /var/log (and any other logging directories), /var/cache if you have it, and possibly portions of /var/db (though you have to be careful with /var/db: Sometimes really important stuff gets put there...)

Beyond that you probably want to do a backup, wait a few days and do another to see what changes over time. If you see a lot of "junk" in those backups you can tailor your exclusion list more carefully.


Once you have selected the stuff you want to back up & tailored your include/exclude lists make sure you do a proper restore test -- take a machine from bare metal and go through the process required to get your data and software working again, without touching the original machine.

If you can't manage that restore with what you backed up you really don't have a backup...


The only folders you should need are /var/www and /var/lib/mysql to get your website and data. And backup /etc/httpd to get your apache configuration, if necessary. See here for a discussion on backing up /var/lib/mysql versus using mysqldump.

If you can use an lvm snapshot to backup from, that would be even better, but be sure to destroy the snapshot as soon as you can. Lvm snapshots destroy your performance.