Linux – Can a linux filesystem be backed up by copying the file structure tree only

backupdevicesfilesystemslinux

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?

Best Answer

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.

Related Question