Re: testing files for read errors by copying to /dev/null
pk wrote:
> Charles Russell wrote:
>
>> I would like to test the integrity of a CD (after burning from .iso) by
>> reading all its files and looking for error messages. (I'm using Cygwin,
>> so I cannot access the CD drive as a dev/, only as a mounted filesystem.)
>>
>> If I try
>> cp -rv /cygdrive/d/* /dev/null
>> then I get a message that /dev/null is not a file or directory
>>
>> If I try
>> tar -cvf /dev/null /cygdrive/d
>> then the command runs so fast it cannot possibly be reading the whole CD.
>>
>> If I try
>> find /cygdrive/d -type f -name '*' -print -exec cat {} >/dev/null \;
>> then the disk drive seems active for a reasonable length of time, but
>> despite the -print flag, I get no output to confirm what is actually
>> happening. I expected the filename to be printed before each file was
>> read.
>>
>> What is the best way to do what I am attempting?
>
> The best way to check burned CDs is to calculate a hash on the medium and
> compare it with the hash of the original .iso file.
My understanding is that the .iso file lacks the error correcting code
included when a CD is burned, so I would not expect hashes to match
unless the operating system handles this transparently. Just out of
curiosity (or not purely from curiosity; I could boot Puppy Linux from
CD and still have access to the CD drive) what would be the approach if
I did have direct access to the /dev ?
If the medium is
> mounted, this is not possible (you can do mkisofs | md5sum on the directory
> where you mounted the medium, but the results will almost certainly be
> different even if the CD has no errors).
>
> If you are content with just trying to read all files on the cd and see
> whether any error is reported (a method far from reliable), then something
> like (on a single line)
>
> find /path/to/mnt -type f -print -exec sh -c 'cat "$1"
>> /dev/null' '{}' '{}' \;
>
> should kind of work.
>
Yes, that works.
|