3

I'm trying to do a simple system backup (with cpio or tar), and I was looking for what I need to back up and found this question. The answer was basically, "it depends on what you're running on your machine".

If there is a disk failure, I want to easily get my server running again without having to reinstall a lot of things. I'm using a web server and a fair amount of 3rd party programs. I'm thinking I'll back up everything except the absolutely unnecessary.

So are there any directories that I shouldn't backup because it would be a waste of time and disk space?

  • 1
    actually you should backup every filesystem but it is not necessary to dump the filesystems which don't have to be retrieved on full-restoration. For example, if /tmp is an independent filesystem, it can be excluded immediately. Similarly, cache data of proxy daemon can also be omitted. As well, the spool, overview database and history of Netnews system may be excluded if you give up on them. – harish.venkat Dec 21 '11 at 19:11
  • I see, so does that mean I tar everything in at / – User1231424214112 Dec 21 '11 at 19:21
  • you can do tar at / or you can use dump see http://surf.ml.seikei.ac.jp/~nakano/dump-restore/dump-restore-mini-HOWTO.en.html#ss3.1 – harish.venkat Dec 21 '11 at 19:27
  • I don't back up the operating system: I backup the configuration (etckeeper to revision control /etc, equivs-control to create deb files to install stuff). – ctrl-alt-delor Oct 24 '16 at 16:15

2 Answers2

7

If in doubt, back up everything that's on disk.

The most obvious things you can skip backing up are swap and /tmp (which may be in virtual memory already).

If you want to save backup space, at the expense of a slower recovery, you can omit /usr, except /usr/local. To recover, do a minimal system installation, install packages you had installed (this is distribution-dependent), then recover from the backup.

There are bits and pieces in /var that you don't need to back up. In particular, anything in /var/cache is meant to be regenerated on demand. There's one exception: /var/cache/debconf/config.dat and /var/cache/debconf/passwords.dat on dpkg-based systems contains Debian package configuration data entered by the administrator (it's out of place under /var/cache).

0

In-memory filesystems and temporary filesystems can usually be skipped. /proc, /sys, /dev etc.

Mat
  • 52,586
Sirex
  • 7,956