Ubuntu – How to Verify/Restore Whole-System Backup of tar czf

16.04backupqualitytartesting

I want to test that the whole system backup corresponds to the original.
It would be great to understand some basic tests about rapid quality assurance because I do not have time to always .untar it completely.
Do backup backup.tar.gz of the system with exclusions

# http://unix.stackexchange.com/a/291720/16920
sudo nice tar czf /media/masi/ntfsDisc/backup.tar.gz --exclude=/home \
    --exclude=/media --exclude=/dev \
    --exclude=/mnt --exclude=/sys \
    --exclude=/run --exclude=/proc /

Tests by Case Studies

  1. How to Handle cases of changed files during the backup?

    tar: Removing leading `/' from member names
    tar: /home/masi/.gnupg/S.gpg-agent: socket ignored
    tar: /home/masi/.config/chromium/Default: file changed as we read it
    tar: /home/masi/.config/chromium: file changed as we read it
    tar: /home/masi: file changed as we read it
    
  2. How to handle ignored sockets?

    tar: Removing leading `/' from member names
    tar: /tmp/.X11-unix/X0: socket ignored
    tar: /tmp/.ICE-unix/1666: socket ignored
    tar: /tmp/qtsingleapplication-7af9-3e8: socket ignored
    tar: /tmp/.org.chromium.Chromium.2qSs7o/SingletonSocket: socket ignored
    

Methods to tests

  1. Take a md5-map of directories. Compare it to the current system. It should not have changed much.
  2. If md5 has changed more than the significance factor
    • Some specific searches of the contents in the directory, which should be enough vertical to each other to satisfy the system testing.
  3. Aim: real-time quality-assurance. To distribute computing and balance between power and time-duration so nice. TODO timing of the process and sub-processes.

Test requirements

  • Permissions/owners unchanged between backup and local files.

System: Ubuntu 16.04
Filesystem of System: ext4
Filesystem of external HD: NTFS

Best Answer

There's not a lot you can do about files that change during a backup, though I guess you could write a wrapper script that replaces those files afterward. On a busy system, you may never finish though.

Unix domain sockets can be ignored safely. They will be recreated the next time the process that created them is started up. They are kind of like a pipe (shell |).

The best way to verify a tar backup is to use Gnu tar's --diff option.

See also https://serverfault.com/questions/293605/check-integrity-of-tar-gz-backup

Related Question