Manfred Schwarb wrote:
>
> Probably, yes.
> You can try the brute force variant "tar -cO /mydir >/dev/null" to try
> to find affected files, but most probably you will find nothing (or
> files at the locations of other broken sectors ;-) ).
>
Hi Manfred,
this does not work with GNU tar.
GNU tar (at least 1.20) does not actually read the files if /dev/null is
detected (by path name or device number).
All of the following commands do not work as expected:
tar -c -f /dev/null /path
tar -cO /path >/dev/null
tar -c -f - /path >/dev/null
>From the tar info file:
"When the archive is being created to `/dev/null', GNU `tar' tries to
minimize input and output operations. The Amanda backup system, when
used with GNU `tar', has an initial sizing pass which uses this
feature."
If /dev/null is not used or its filedesc is hidden from tar, GNU tar
reads all files. The following works:
tar -cO /path | cat >/dev/null
tar -cO /path | wc -c
tar -cO /path >/dev/zero
(Use /dev/zero only if present :-)
Cheers,
Christian

Bruce Allen wrote:
>
> Hi Christian,
>
> I am often (pleasantly) surprised by the level of (OK, obscure!)
> knowledge in this group! Kudos!!
>
Hi Bruce,
Thanks :-)
Actually this knowledge is only a few days old. I tried to find the
affected files on a damaged CD with tar but it didn't work as expected.
The reason was easy to find in the tar source, but hard to find in tar
documentation :-)
Cheers,
Christian

Manfred Schwarb wrote:
> ...
> Christian,
> thanks a lot!
>
> Well, when preparing some text for the badblock howto, I simply tried
> "tar -cf /dev/null" vs. "tar -cO /path > /dev/null", and found
> large timing differences (the former finishes in only some few seconds), so I assumed
> that the latter works.
> I think, at this time I had no broken disk at hand, so I could not verify it.
> Maybe it also depends on the version of GNU tar.
>
>
Yes, probably the fstat(1,..) check was added in a later version.
> This means the text in badblockhowto.html is wrong.
> Could you change the tar example in the badblockhowto.html? That would be great!
>
>
Changed in CVS.
Cheers,
Christian