How to validate a DVD against an ISO

comparisondvdiso-image

I have an ISO file and a DVD burned from that ISO file. Is there a way I can validate that the DVD contains the same as the ISO file and that nothing is wrong with the DVD?

I have the tools available on the System Rescue CD.

Best Answer

The following command compares the contents of two binary files, and print the offset of the first differing byte. Replace /dev/dvd by the path to the DVD device (/dev/cdrom, /dev/scd0, /dev/hdc, …).

cmp /dev/dvd /path/to/foo.iso

I'm not sure if all DVDs contain an indication of where the data ends (I think some CDs don't); you can limit the comparison to the size of the image file.

ls -l /path/to/foo.iso  # copy the file size, e.g. 123456789 bytes
cmp -n 123456789 /dev/dvd /path/to/foo.iso

You can also compute a checksum for the image file, compute a checksum for the disk, and check that they match. This is slower for a single comparison, but faster if you need to compare many disks against one image, and allows the image and the disk to be on different computers. To detect accidental corruption, md5sum is perfectly suitable.

md5sum /path/to/foo.iso
md5sum /dev/dvd     # if the size can be determined; otherwise:
head -c 123456789 /dev/dvd | md5sum
Related Question