How To Verify And Test Unix File Archive/Backup
-
Each time in our corporate IT operations, we have our backup running in place maybe on daily/weekly/monthly
The application & database backup was directly spooled into the backup tape device.
Is very important to verify tar command completed without any error just to ensure the backup files was usable when comes to disaster recovery.
How can you verify the reliability of an archive? The tar command with -d (difference) option will show any files that are different in the archive from their originals on the disk. If this is done immediately after a backup, you should be prompt back without output.
If you include -v, it would have listed every file on the tape as it examined and printed any errors after the end of the filename.
You can do this some time after the backup, and tar -d option will tell you what has changes in your system after the backup.
$ tar -cvf smartoptimizer.tar smartoptimizer smartoptimizer/ smartoptimizer/config.php smartoptimizer/index.php smartoptimizer/LICENSE smartoptimizer/CHANGELOG smartoptimizer/minifiers/ smartoptimizer/minifiers/js.php smartoptimizer/minifiers/css.php smartoptimizer/README smartoptimizer/cache/ $ tar -df smartoptimizer.tar $ tar -tvf smartoptimizer.tar drwxr-xr-x oracle/oracle 0 2009-06-16 06:52:42 smartoptimizer/ -rw-r--r-- oracle/oracle 1722 2008-12-16 01:54:38 smartoptimizer/config.php -rw-r--r-- oracle/oracle 6837 2008-12-16 01:55:09 smartoptimizer/index.php -rw-r--r-- oracle/oracle 35147 2008-12-05 23:53:17 smartoptimizer/LICENSE -rw-r--r-- oracle/oracle 2819 2008-12-16 02:59:58 smartoptimizer/CHANGELOG drwxr-xr-x oracle/oracle 0 2009-06-16 06:50:06 smartoptimizer/minifiers/ -rw-r--r-- oracle/oracle 3163 2008-12-06 09:48:44 smartoptimizer/minifiers/js.php -rw-r--r-- oracle/oracle 3222 2008-12-16 02:47:32 smartoptimizer/minifiers/css.php -rw-r--r-- oracle/oracle 2563 2008-12-06 02:45:00 smartoptimizer/README drwxr-xr-x oracle/oracle 0 2009-06-20 20:04:38 smartoptimizer/cache/
Now you realize I used another tar with -t option just to view the content of an archive file. With the -v option, you will see the owner and permission of the file whereas without it you will see the normal file listing.
$ tar -cvzf smartoptimizer.tgz smartoptimizer smartoptimizer/ smartoptimizer/config.php smartoptimizer/index.php smartoptimizer/LICENSE smartoptimizer/CHANGELOG smartoptimizer/minifiers/ smartoptimizer/minifiers/js.php smartoptimizer/minifiers/css.php smartoptimizer/README smartoptimizer/cache/ $ tar -df smartoptimizer.tgz tar: This does not look like a tar archive tar: Skipping to next header tar: Archive contains obsolescent base-64 headers tar: Error exit delayed from previous errors $ tar -tvf smartoptimizer.tgz tar: This does not look like a tar archive tar: Skipping to next header tar: Archive contains obsolescent base-64 headers tar: Error exit delayed from previous errors
$ tar -cvzf smartoptimizer.tar.gz smartoptimizer smartoptimizer/ smartoptimizer/config.php smartoptimizer/index.php smartoptimizer/LICENSE smartoptimizer/CHANGELOG smartoptimizer/minifiers/ smartoptimizer/minifiers/js.php smartoptimizer/minifiers/css.php smartoptimizer/README smartoptimizer/cache/ $ tar -df smartoptimizer.tar.gz tar: This does not look like a tar archive tar: Skipping to next header tar: Archive contains obsolescent base-64 headers tar: Error exit delayed from previous errors $ tar -tvf smartoptimizer.tar.gz tar: This does not look like a tar archive tar: Skipping to next header tar: Archive contains obsolescent base-64 headers tar: Error exit delayed from previous errors
From the prompt that you saw above, the tar -d or tar -t doesn’t support for compressed tarball with .tgz or .tar.gz extension.


Recent Comments