It's amazing how many backup tips don't mention the following:
The linux system (and most multi-thread OS's) generally need to be quiescent while you are backing up and restoring.
This is most easily achieved by not running an OS on it while you're trying to image it.
For backup and restore, it can be mounted, and in-fact probably must be, but not by the running OS as its root (/).
Reason: In every multi-tasking operating system, linux included, there are simultaneous code threads running affecting files which makes it impossible to do accurate system-wide file-set backups or restores.
In particular, while you're grabbing files, there might be some other task creating or deleting files such that your backup won't represent a true and accurate image of the file-system at any given moment in time. If you try to restore this backup you will have data corruption which will lead to crashes, and other anomalies.
Options: Backups need to be either done by special software and/or disk systems (like Acronis on Windows for example which can backup a running OS), or by an external secondary OS accessing the non-running OS's files that you're trying to backup or restore.
!!! So when you see web pages telling you to use Deja-dup for example to do your backups, this only works for /home
and then ONLY if you aren't running any programs affecting /home
while you are running deja-dup. (And even then you might want to cross your fingers unless you really know what might possibly touch your files via a daemon.)
Good points on using higher-level tools -
tar
,cpio
andrsync
all work within the filesystem, so this may be appropriate.dd
, OTOH, works directly with disk blocks, bypassing the FS. – Piskvor left the building – 2012-03-04T16:26:41.033