LJ Archive

How Do We Know That the Image Is Correct?

Sometimes ISO 9660 images can have errors. We'd like to make sure that our images are error-free. To do this, we can compare the ISO image to the original CD-ROM directly. Mount the CD-ROM disk, and do the same to the ISO 9660 image (using the loopback device, as described in the “Make ISO 9660 Images of the CD-ROMs” section).

Run the following script, assuming the real CD-ROM is mounted in /mnt/cdrom and the ISO image is mounted in /mnt/isosrv/image1:

#!/bin/sh
cd /mnt/cdrom && find . -type f | sort |
sed -e 's/^/"/' -e
's/$/"/' |
xargs cksum > CDROM.sums
cd /mnt/isosrv/image1 && find . -type f | sort |
sed -e 's/^/"/' -e
's/$/"/' | xargs cksum > IMG.sums
echo
diff CDROM.sums IMG.sums | more

If there is any output after the echo statement, then the image file has errors (or possibly the CD-ROM drive is not functioning correctly).

LJ Archive