This might be considered to be more of an academic question but here goes. Returning to Linux after some years away, I installed Ubuntu 15.04 Desktop on a small PC.

Looking around the file system I see "real files" such as programs in /bin and /usr/bin but I also recall that Linux treats device IO via the file system. So there is a /dev directory with apparent files inside of it. I saw 'files' in /proc.

If I want to preserve my filesystem (in the context of Linux resurection after death of a disk for example) I could easily tar the contents of the /bin and /usr/bin directories and recover these type of files.

What files are written at the time the computer boots and could these be safely ignored as part of a backup? Also, how about special permissions or hard links and so forth?

2 Answers 2


If your question is actually about restoring a system after a crash, you can safely forget about tar: it has a limit to the maximum length of the paths that is hardcoded in the format specs, and it doesn't handle hardlinks. For similar reasons, you shouldn't try to do backups with cp, pax, cpio, or rsync. A reasonable solution is to use dump / restore, or, better yet, use a dedicated package for backups. But that only addresses the problem of saving your files. It doesn't address issues related to size differences between old and new disks, or making your disks bootable.

  • using dd and verifying integrity with a cryptographic hashing algorithm like sha256sum would also work Commented Apr 29, 2015 at 9:39
  • Yes, dd is good for full images. But it isn't very efficient, since it doesn't do anything special about empty sectors (dd_rescue addresses this problem), and it still doesn't address the problems I mentioned above. dump / restore is still to be preferred for regular backups, at the very least because it can handle incremental backups.
    – lcd047
    Commented Apr 29, 2015 at 9:48
  • The disk would be bootable though, that's a plus, right? Commented Apr 29, 2015 at 19:43
  • @cremefraiche: With dd? That depends on what you image, and on the geometry of the disk you're restoring the image to. Assuming you're running Linux on a PC, it's a good idea to backup the partitions' sector (i.e. dd if=/dev/sda of=part.bin bs=512 count=1, and save part.bin somewhere else), and make separate backups for each partition (/dev/sda1 etc.). But that might not be enough to make bootable a disk with a different geometry.
    – lcd047
    Commented Apr 29, 2015 at 20:07

A very common and simple methods to backup a linux machine is using rsync. And to your question, yes you can backup the file system tree, but the so called pseudo-filesystems like /dev or /proc are usually excluded in the file list of such a backup.

See the following command:

 $ rsync -aHv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /* /path/to/backup/dir

It runs rsync in archive mode -a (equals -rlptgoD (no -H,-A,-X)), shows verbose output -v, and preserves hard links -H. Also there is a list of directories that are excluded from the backup.

  • rsync is good for backing up data. It's mostly useless for entire disk images. Please see the discussion in a previous post here.
    – lcd047
    Commented Apr 29, 2015 at 10:05
  • Backing up using disk images is not very useful. I have used rsync to backup my systems for at least 10 years and have done system recoveries with it. With e.g. Debian all you need is the list of installed packages, the contents of /etc and your user data and you can restore to an identical system quickly.
    – wurtel
    Commented Apr 29, 2015 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .