Motivation: linux tar cannot copy every file (does not like fifos for example)
Solution: find and cpio
Nice: cpio is
- really fast
- reads every file
- features crc-checks
Doing the backup
Backup one filesystem with the archive on the same filesystem:
Name of the archive (example): backup_crc.cpio
find . -depth -mount ! -name backup_crc.cpio | cpio --create --format=crc \
--force-local --verbose > 'backup_crc.cpio'
To exclude a whole directory, e.g. /tmp, substitute the above find by
find . -mount -path './tmp' -prune -o -print
(prune does not work with -depth)
If your filesystem does not support files bigger than 2 GB, you could use split:
find . -depth -mount ! -name backup_crc.cpio | cpio --create --format=crc \
--force-local --verbose | split -b1024m - 'backup_crc.cpio'
Doing the restore
Go to the destination directory
cat 'backup_crc.cpio' | cpio --extract --preserve-modification-time \
--make-directories --format=crc --force-local --verbose
In the case you splitted the archive, just do
cat 'backup_crc.cpio'.* | cpio --extract --preserve-modification-time \
--make-directories --format=crc --force-local --verbose
Testing the archive
List contents:
cat 'backup_crc.cpio' | cpio -t
CRC check (does not show emtpy files, links, etc.):
cat 'backup_crc.cpio' | cpio --extract --only-verify-crc --verbose
Some infos about cpio (in german) on
Linux-Magazin