General discussion

Locked

How to verify a TAR backup?

By tsilok ·
I am having problem using -W or --verify of TAR command, be it to remote tape drive or on server itself.

I have tried with corresponding error prompted:
[1] >> tar --verify test.tar
You must specify one of the `-Acdtrux' options

[2] >> tar -dW test.tar
[3] >> tar -tW test.tar
Cannot verify stdin/stdout archive

[4] >> tar --diff --file /dev/st0 --verbose --verify
No response.

Could someone quote me an example on how use the combination?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by vicrh In reply to How to verify a TAR backu ...

Hello,

Try with "tar cvWf file.tar *" on a test directory with some files.

You should see that it first adds the files on the directory to the tar archive and then verifies them.

Regards,
Victor

Collapse -

by stress junkie In reply to How to verify a TAR backu ...

I'm just adding to vicrh's correct answer. The verify function works with the create command. It is not an independent function. The following section from the man page for the tar command states that one of the listed functions must be used with any invocation of the tar command. Verify is not on this list. So verify must work with one of these listed functions. It turns out, as I already mentioned, that verify works with the create function.

The man page for the tar command says the following:

FUNCTION LETTERS
One of the following options must be used:
-A, --catenate, --concatenate
append tar files to an archive

-c, --create
create a new archive

-d, --diff, --compare
find differences between archive and file
system

--delete
delete from the archive
(not for use on mag tapes!)

-r, --append
append files to the end of an archive

-t, --list
list the contents of an archive

-u, --update
only append files that are newer than
copy in archive

-x, --extract, --get
extract files from an archive

Collapse -

by stress junkie In reply to

Did you notice that one of the function letters for tar is -d which stands for differences? This allows you to compare differences between an archive and the file system.

-d, --diff, --compare
find differences between archive and file
system

Example:

tar -df tarfile.tar /filesystem

You can also add options like v for verbose and z for zip compression as in:

tar -dzvf tarfile.tgz /filesystem

Collapse -

So what if I can't verify -during- the write?

by kitgerrits In reply to

How can I check if a tar file is corrupted?
tar -tvf will only list the files, not test the contents.

I make my backups through an SSH connection.
This will redirect output through the SSH connection to a file, but it will not allow tar to read its own output.

Is there any way to verify if a file that was already written?
'tar -tvwf file.tar' does not work, as stated above.

Collapse -

Hmmm

by techn9 In reply to So what if I can't verify ...

So it sounds like you CAN'T "verify" an archive AFTER you've created it, you can only compare "differences" between the archive and original folder? "Verify" is useful for verifying the integrity of the backed up media(only while "creating" the archive), while compare "differences" only displays what the media thinks what it's storing differences are. So I understand.

Here is a little more info:http://www.gnu.org/software/tar/manual/html_section/verify.html

Back to Linux Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums