Tar and other file archiver may miss some specific file attributes and special files. At least for ext2/3/4 file systems, old fashion BSD dump and restore utilities (debian package simply named dump) remains a perfect solution to backup an entire file system. The following procedure may help to move a filesystem from a disk to another.
- backup root filesystem to a file. Beware! Avoid to put the backup file on the filesystem to be dumped:
# dump -0z -f /mnt/backup/rootfs.dump.gz
- to restore the filesystem, first create a new fresh partition and empty file system (fdisk + mkfs). Then use restore command to unpack the dump file into the new file system.
# cd /mnt/newfs # restore -f /mnt/backup/rootfs.dump.gz