Verifying a DVD is correctly created

opensuse v11.3
linux 2.6.34.8-0.2-desktop x86_64

It took me 3 tries to get is ISO image that matched the md5 checksum on the download site. At 8 - 10 hours each it was a PITA. The first simply aborted 1/3 of the way through (HTTP direct link). The second used wget, got a full file but the checksums didi not match. The magic method was Bitorrent.

All this has left me with an uneasy feeling about the contents of the DVD created from the ISO. Is there a way to test the DVD contents?

When you install openSUSE, there is an option at the front of the installation to check your media. Also, in YaST / Software / Media Check, can also check the media if you have a running openSUSE copy. I would assume a LiveCD would offer the same, but the media check during the installation may be your option. Just boot from the disk, select Installation and look for the media check option.

Thank You,

On 2011-04-30 22:06, jimoe666 wrote:

> got a full file but the checksums didi not match. The magic method was
> Bitorrent.

Metalinks with aria2c.

> All this has left me with an uneasy feeling about the contents of the
> DVD created from the ISO. Is there a way to test the DVD contents?

The program you used to burn dvds should have feature. K3b does.

In console, I use this in a script:

Code:

cmp --bytes=$(wc -c <$1) /dev/dvd $1


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

That --bytes=$(wc -c < $1) is redundant. If you assume that $1 is correct, and you do a normal cmp without --bytes, then

if there is a mismatch anywhere, cmp will say so, same behvaviour
if /dev/dvd is shorter, cmp will say EOF on /dev/dvd, same behaviour
if /dev/dvd is the same size, and there is no mismatch, cmp will exit silently, same behaviour
if /dev/dvd is longer, cmp will say EOF on $1, which is the case where there is a difference but it’s good to know that something has been padded to the DVD (which shouldn’t happen actually, but the DVD is still usable)

So in short, if you don’t mind ignoring EOF on $1 as correct, you can save one read of $1.

On 2011-05-01 02:06, ken yap wrote:
>
> That --bytes=$(wc -c < $1) is redundant. If you assume that $1 is
> correct, and you do a normal cmp without --bytes, then

No, it is not redundant.

We discussed that code time ago in one of the mail lists. We had the
problem that a direct cmp would fail, because, apparently, the burned image
is sometimes bigger than the iso file, because the burner can round the
size up to a figure multiple of 8 KiB or something. That tail is empty, not
used, but still a direct compare will try to compare that part and say
there is a size mismatch.

> So in short, if you don’t mind ignoring EOF on $1 as correct, you can
> save one read of $1.

No, it is instantaneous. Try.

I’ll save you time:

cer@Telcontar:~> time wc -c <
/home/cer/download/Firefox_downloads/openSUSE-11.4-DVD-x86_64.iso
4614782976

real 0m0.002s
user 0m0.000s
sys 0m0.002s


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

That’s what I meant by if you accept that EOF on $1 is harmless. BTW it’s not the burner that pads the burn, it’s the software. The image is already padded so that precaution is unnecessary, but harmless.

You probably got an instantaneous response from the wc because you had the blocks cached in RAM.

And if you really want to be more thorough with the checking you should only compare as many 2048 byte blocks as the ISO image specifies. That will also catch some $1 errors. But in this case $1 is known to be good.

On 2011-05-01 04:06, ken yap wrote:
>
> That’s what I meant by if you accept that EOF on $1 is harmless. BTW
> it’s not the burner that pads the burn, it’s the software. The image is
> already padded so that precaution is unnecessary, but harmless.

That’s the theory, but not the fact. As I said, we had to made that code up
because the images we had did not pass a plain cmp test. The line of code
was not designed for pleasure, but because we had a problem.

You can dig out the thread in the mail list where we discussed the matter
and the explanations were found. I had images that did not compare to the
dvd, I asked, and got answers. The why it happened and how to solve it.

If you look up in the manuals, you will see that the padding is optional,
at least with some CLUs.

> You probably got an instantaneous response from the wc because you had
> the blocks cached in RAM.

Most certainly not. Thats the ~4 GiB iso of the distribution, and I haven’t
used it in two weeks. Look, I’ll repeat the test with another file I
haven’t used in months:

cer@Telcontar:~> time wc -c < /data/storage_a/imgs/crypta_f1_dvd.mm.xfs
4700012544

real 0m0.019s
user 0m0.000s
sys 0m0.002s

By the way: the image above is for a DVD, but not ISO.

Another one, 11GB in size:

cer@Telcontar:~> time wc -c < /data/storage_b/copias_vmware/OpenSuSE
11.1/OpenSuSE\ 11.1-flat.vmdk
11274289152

real 0m0.002s
user 0m0.001s
sys 0m0.000s

Try it yourself.

> And if you really want to be more thorough with the checking you should
> only compare as many 2048 byte blocks as the ISO image specifies. That
> will also catch some $1 errors. But in this case $1 is known to be good.

$1 is the image file, and its exact size determines the comparison. It
doesn’t matter if the DVD is bigger.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

What I am pointing out is that $1 is sometimes larger than it needs to be due to padding added by the release and even if the pad blocks are in error, it will not affect correctness of the DVD. But that’s a very small probability of a false negative.

Looks like the GNU people coded cmp to look at FD 0 and if it’s a file do a stat() for the size as an optimisation. It should be interesting to verify this by doing a strace on cmp.

Sorry, I meant wc, not cmp. The things you remember after the 10 minute deadline has passed. :slight_smile:

On 2011-05-01 12:06, ken yap wrote:
>
> Sorry, I meant wc, not cmp. The things you remember after the 10 minute
> deadline has passed. :slight_smile:

Yes, wc. I know, I was very surprised when they told me that trick. I
thought the same as you did, that it would be very slow. And behind a pipe!
But no, it simply reads the size somehow.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

On 04/30/2011 10:36 PM, jdmcdaniel3 wrote:
>
> When you install openSUSE, there is an option at the front of the
> installation to check your media.

to do that, boot the DVD and do this:

http://tinyurl.com/2ebcf27

any reported is too many…

once sure you have a perfect iso, then items to consider to get a
perfect disk include:

-burn at slowest possible speed
-use best possible media
-hope your burner is still aligned perfectly
-keep the fingers off the back side
-and, some more how-to make a good disk is included in this, a link on
the download page:

http://en.opensuse.org/SDB:Download_help


CAVEAT: http://is.gd/bpoMD
[openSUSE 11.3 + KDE4.5.5 + Thunderbird3.1.8 via NNTP]
HACK Everything → http://www.youtube.com/watch?v=j5b4CCe9pS8&NR=1