Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have tar files where I archive about 250 files, each about 80 Mb, without compression. In a few cases tar is only returning some of the files. For example, when doing an extract of the file using:

tar -xvf 356.tar

I got only 103 files, when it should return 255 files, but tar does not give me an error. Furthermore, the tar archive is 15.8 Gb while the extracted folder is just 6.4 Gb. The tar files were created using

tar -cvf 356.tar 356

where 356 is the name of the folder.

All the steps where done in the same machines, under Ubuntu 6 and newer. Any ideas if there is a way to recover the files that are not being extracted?

share|improve this question
A few questions that come to mind: are you extracting on a native linux filesystem (i.e. not FAT or NTFS)? Do the file names have anything special (very long, contain non-ASCII characters, etc.)? How many files does tar -tvf 356.tar list? – Gilles Aug 3 '10 at 18:20
Always linux native, ext3, and the filenames are normal characters, just alphanumeric and underscores. tar -tvf 356.tar lists 103 files. – ljvillanueva Aug 3 '10 at 21:46
Do you get the same results with a different implementation of tar? There's at least pax (pax -v <356.tar to list files, pax -r -pp <356.tar to extract). – Gilles Aug 3 '10 at 22:00
I forgot the obvious... Do you have some way (e.g. checksums) to make sure the archive wasn't corrupted between the time it was created and the time you tried to extract it? – Gilles Aug 3 '10 at 22:48
pax is not able (apparently) to open it: pax: Failed open to read on 356.tar: Value too large for defined data type Unfortunately I did not think of storing data to check the status of the file. I'll have to add that and be more paranoid with the archives. – ljvillanueva Aug 4 '10 at 16:37

I know this is a bit obvious, but could any of the extracted files be hidden?

Have you tried just listing the contents of the tar prior to extraction?

share|improve this answer
Nop, regular ls and ls -a gives the same number of files. Listing gives me the same number of files as the ones extracted. What is weird is the size discrepancy. – ljvillanueva Aug 3 '10 at 21:43

Which platform are you taring and where you are extracting. If you are taring in Linux and untaring in windows then you might find unusual behavior due to long filename. did you do a tar -tvf 365.tar against the ls -lR 365 and see if that matches.

tar -tvf 354.tar > 1.log
ls -lR 365 > 2.log
diff 1.log 2.log

does the above helpful.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .