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...

  • /sys should be ignored too. – Jmarki May 24 '11 at 1:31
  • /sys is another good one to ignore - also if you have BIND running in a chroot you want to ignore the /dev, /proc, etc. under the chroot... – voretaq7 May 24 '11 at 14:35
  • 2
    Please do not ignore logfiles. That is unless you have some other mechanism to get data back you might need for debug purposes. – serverhorror Jun 19 '11 at 18:52
  • @Server Horror - true, if you don't have remote syslog set up you may want to back up logs too -- The downside to doing so is that log rotation looks (to most backup software) like every file changed: You'll be making several copies of each rotated log. Not a problem for some systems, an extra gig or so a day for busy web servers with verbose access logs... – voretaq7 Jun 20 '11 at 16:29

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.

  • 5
    That's a good start on backing up MySQL, but saying "The only folders you should need" is EXTREMELY dangerous, especially when you're not familiar with the environment - There could be critical stuff in other locations (e.g. user/password info in /etc/passwd & /etc/shadow SSH keys under /home, custom scripts under /usr/local...). Generally it's better to build a list of what can be safely excluded from a backup rather than trying to capture everything you need with specific includes. – voretaq7 May 24 '11 at 14:38

Too little info, sorry.

Is this a webserver, database server, samba server, nameserver. It completely depends on what kind of services are running.

I usually don't backup anything that is provided by the distribution (everything that comes from a package). The things I do have backups for are:

  • configuration files
  • log files (just in case something nasty happens)
  • "data" - that would be zone files for bind, ldap "dumps", database dumps and whatnot.
  • home directories if there are real human users logging in to the servers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.