That procedure has always worked for me. I tried using unetbootin
with debian but for some reasons I was never able to make it work for Debian ISOs (strangely, it works without problems for other distros i've tried like Ubuntu, Finnix (both Debian based!) and CentOS).
But now, starting from Squeeze
release, I found that the netinstall iso image works flawlessly from USB, too!
Download it and do
dd if=debian-*-netinst.iso of=/dev/sdX
where /dev/sdX
is your USB stick.
In addition to Gilles answer,
If you still have the ISO image, you could use cmp
instead of checksums. It would tell you at which byte the difference happens. It would also make the check faster as if there is an error early on, it would tell you right away, whereas the checksum always has to read the entire media.
$ cmp /dev/cdrom /path/to/cdrom.iso
In case of error it should print something like this
/dev/cdrom /path/to/cdrom.iso differ, byte 123456789, line 42
In case it's correct it should print nothing, or this:
cmp: EOF on /path/to/cdrom.iso
Which means there is more data on /dev/cdrom
than in the ISO, most likely zero-padding.
Even before starting any comparisons, you could check the size.
$ blockdev --getsize64 /dev/cdrom
123456999
$ stat -c %s /path/to/cdrom.iso
123456789
If it's identical, the checksum should match also. If /dev/cdrom
is larger, it should be zero padded at the end. You could check that with hexdump
. Use the ISO size for the -s
parameter.
$ hexdump -s 15931539256 -C /dev/cdrom
3b597ff38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
3b597fff8 00 00 00 00 00 00 00 00 |........|
hexdump
is also useful for having a look at difference at any other position in a file, in case a damage was caused deliberately by something.
Best Answer
You can use
cmp
for checking if everything was copied fine:This solution does not explicitly compute the checksum of your
/dev/sdX
- but you don't need to do that because you have already done this for the source of the comparison (i.e.debian-X-netinst.iso
).Doing just a
dd if=/dev/sdX | sha1sum
may yield a mis-matching checksum just because you get trailing blocks (/dev/sdX
is most likely larger than the iso-file).Via
cmp -n
you make sure that no trailing bytes on your/dev/sdX
are compared.If you are paranoid about the quality of your USB mass storage device you call
sync
, eject it, re-insert it and then do the comparison - else all or some blocks may just come from the kernels VM (cache) - when in reality perhaps bits on the hardware are screwed up.