[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: iso verification: results - successful but still bewildered



Hi,

i wrote:
> > Your file yielded two blanks on this shell command
> > dd if="/dev/sdb" bs=2048 skip=16 count=1 |
> > dd bs=1 count=6 | od -x | head -1 | \
> > awk '{print $2 " " $3 " " $4}'

Andrew F Comly wrote:
> Do you mean that you want me to try out these commands?

Not necessarily. On the first hand it was a technical diagnosis.
My theory is that you did not have the permissions to read the device.

(The script ./check_debian_iso should distinguish between unknown data
 and no data and rather report something like
   "Unable to read data from byte address 32768".
 But probably it needs a new home first, because George Danchev is
 too busy with other things to upload new versions.)


> Or is the program
> not usable on an average lubuntu 14.04 Samsung netbook like mine?

Besides the confusing way to say "no data", the script should be well
usable on any GNU/Linux, Solaris, and with some info about the local
checksum programs also on the BSD Unixes.


> May I assume that the number "1255424" is the records in/out integer?

Yes. Because the block size of the ISO is 2048 bytes and the number
tells blocks of size 512, this number is supposed to be exact.
With dd bs=1M, you had the risk to get a non integer count instead of 613.
But thanks to H. Peter Anvin's isohybrid prescriptions, the small
sized i386 bootable ISOs are size aligned to full MB.

So this command would have cut out the exact amount of data,
if you had told it the same block size as with your copying command.
You did:

> $ dd if=/dev/sdb count=613 | sha256sum

It should have been:

  dd if=/dev/sdb count=613 bs=1M | sha256sum


You meanwhile ran one with the correct combination of default block
size and block count:

> $ dd if=/dev/sdb count=1255424 | sha256sum
> ...
> fd7729e3bdfcb2b1b8793f5a19096fb2eee3cf709c39112ed2da7e7a2d7f6886  -

The result looks very good. File SHA256SUMS has

  fd7729e3bdfcb2b1b8793f5a19096fb2eee3cf709c39112ed2da7e7a2d7f6886  debian-8.5.0-i386-lxde-CD-1.iso

Your /dev/sdc in its first 613 MB bears the same bytes as the lxde ISO.

(Actually there are lots of files of the same size which would yield the
 same result. But they hide among a superzillion other possible file
 contents of a 613 MB file. So we are certain and can hardly be wrong.)


> Quite incredible, with the 'magic' number of "1255424" and using sha256sum
> the "/dev/sdb" and the original iso MATCH!!!

It's all about cutting out the exact number of bytes.

> Where does the number 1255424 come from?

"dd bs=1M count=613" cuts the same number as "dd count=1255424",
because 1M = 2048 blocks of 512 bytes, and 613 multiplied by 2048 yields
1255424.

The secret ingredient here is the dd default block size bs=512.
One has to deduce it from these statements in man dd:

       bs=BYTES
              read and write up to BYTES bytes at a time
       ...
       ibs=BYTES
              read up to BYTES bytes at a time (default: 512)
       ...
       obs=BYTES
              write BYTES bytes at a time (default: 512)

Further one has to take into account that in dd "1M" is not 1 million
but rather 1 MiB (programmer's megabyte):

    N and BYTES may be followed by the following multiplicative suffixes:
    ... M =1024*1024 ...

As said, we were lucky that the image size is divisible by 1M without
remainder. Else we'd not get such a nice integer computation.


> It looks like the sha512sum of the /dev/sdb and the original iso MATCH ALSO!!!

Now that you are on the right track, success becomes normal.


> P.S. -  Is there any forum (like linuxquestions.org) that I could post this
> on?

There is http://forums.debian.net/ .
If you say "xorriso", google will probably lure me in within a day.


Have a nice day :)

Thomas


Reply to: