1753808 Members
8551 Online
108805 Solutions
New Discussion юеВ

Re: TAR issue

 
Richard Nettleton
Occasional Contributor

TAR issue

We have a directory which when we tar, doesn't complete correctly, and doesn't produce any errors, but looks like it just ends correctly. How do you start to investigate such a problem?
cc
10 REPLIES 10
gstonian
Trusted Contributor

Re: TAR issue

What command are you using ?

If you use the verbose option ( -v ) I would hope any errors/anomalies would present themselves
Peter Godron
Honored Contributor

Re: TAR issue

Ric hard,
could you please expand on "doesn't complete correctly" ? Are certain files (links) not being tared up ?

Please list the command used and problem definition, like expected vs. actual results.
Richard Nettleton
Occasional Contributor

Re: TAR issue

The command being used is:

tar -cvf xxxxx.tar xxxxx (where xxxxx is the directory name).

It appears to run through and end normally, and produces no errors, but the tar file is imcomplete. Directory size is 302982861 then when I tar it and extract it again it is just short at 302927757. Is there a logging option which can be applied?
cc
Georg Tresselt
Honored Contributor

Re: TAR issue

Have you tried to untar the tar file somewhere else to see what is missing?
http://www.tresselt.eu
Peter Godron
Honored Contributor

Re: TAR issue

Richard,

Create a list of tar files:
tar -tvf x.tar > a.lis
Extract the filenames only:
awk '{print $NF }' a.lis > b.lis

Create a list of files in directory:
find /dir > c.lis

Compare the two:
sdiff -s b.lis c.lis

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
Patrick Wallek
Honored Contributor

Re: TAR issue

Have you actually checked the contents of the directories to see if they do or don't match?

Size is not always a good indicator. It is possible that the directory you tar'ed had subdirectories that had grown in size over the years. When you extracted the files the sub-directories were recreated, but now have a smaller size, due to fewer files in those sub-directories.

I would advise going through the directories and doing a cksum on the files (files ONLY not directories). Compare the cksums from the original and the one created from the tar restore.

If they all match, then you are OK.

Something like this may work:

# find xxxxx -type f | xargs cksum >> orig.cksum
# find xxxxx.new -type f | xargs cksum >> new.cksum

# diff orig.cksum new.cksum
Richard Nettleton
Occasional Contributor

Re: TAR issue

Having looked through the directory structure it was noticed that some files had owners of '111', where it looks like the owner had been deleted leaving the PID, changed these to root and the tar has worked okay, very strange that no error messages were produced, but at least it's resolved????
cc
Patrick Wallek
Honored Contributor

Re: TAR issue

If you were running the tar as root, that should have had no effect. You should have seen 'owner not found' or something like that when running the tar though.

By the way, the 111, is the UID of the user that was the owner.
Laurent Menase
Honored Contributor

Re: TAR issue

There are also some other question you must look at:
- how many file is there in the directory?
- Does the directory change while you tar?
- what is the size of the tar file?