Re: testing files for read errors by copying to /dev/null
On Mon, 24 Mar 2008 20:33:43 +0100, pk wrote:
> Charles Russell wrote:
>
>>> 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 ?
>
> Well, this has always worked for me:
>
> $ md5sum install-x86-minimal-2007.0-r1.iso
> 81f244b5978b682cf9f2a313410cdbdf install-x86-minimal-2007.0-r1.iso
>
> Burn the .iso to the CD, and then:
>
> $ md5sum /dev/cdrom
> 81f244b5978b682cf9f2a313410cdbdf /dev/cdrom
>
> (of course, you can use the hash tool of your choice, like sha1sum or
> others, Also, the CD device might not be /dev/cdrom in your system, but
> instead /dev/hd<something>, or even something else).
>
> In any case, if the burned CD has errors in it (not just physical read
> errors - even single-bit errors), the hashes will be different.
Hashes are great when you can use them to optimize performance, but in
this case, it seems like a byte for byte comparison would be just as
fast, and actually a little easier - using something like cmp.
Also, be wary of your buffer cache, assuming that cdrom's aren't written
to using O_DIRECT or similar. You could end up with the right stuff in
cache but the wrong stuff on the physical media. Popping the cd and
shoving it right back in should be sufficient to be sure you don't have
the cd cached.
|