Pages

08 November 2012

Verify a CD/DVD after burning it from an iso image.

When you have written an .iso image to a cd/dvd you should verify that it was written and closed properly. This can be done with md5sum as shown below.
NOTE:  Although I have actually mounted the .iso image and md5summed that instead of an actual cd, the principal is the same, except you would use "/dev/cdrom" instead of "/dev/loop0".

  1. clive@dogmatix > pwd
  2. /home/clive/temp
  3. clive@dogmatix > mkdir testmount
  4. clive@dogmatix > ll -h My_cd_09.iso                          
  5. -r--r----- 1 clive clive 644M 2012-09-11 13:16 My_cd_09.iso
  6. clive@dogmatix > sudo mount -o loop My_cd_09.iso /home/clive/temp/testmount/
  7. clive@dogmatix > md5sum My_cd_09.iso
  8. cf8b114922fc3fcb0d356825e89b5c49  My_cd_09.iso
  9. clive@dogmatix > dd if=/dev/loop0 2>/dev/null | md5sum
  10. cf8b114922fc3fcb0d356825e89b5c49  -
  11. clive@dogmatix > isoinfo -d -i /dev/loop0   ### Unwanted lines removed below. ###
  12. CD-ROM is in ISO 9660 format
  13. System id: LINUX
  14. Volume id: My cd 09
  15. Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR
  16. Logical block size is: 2048
  17. Volume size is: 329453
  18. Joliet with UCS level 3 found
  19. Rock Ridge signatures version 1 found
  20. clive@dogmatix > dd if=/dev/loop0 bs=2048 count=329453 conv=notrunc,noerror  | md5sum
  21. 329453+0 records in
  22. 329453+0 records out
  23. 674719744 bytes (675 MB) copied, 1.57553 s, 428 MB/s
  24. cf8b114922fc3fcb0d356825e89b5c49  -
  25. clive@dogmatix > dd if=/dev/loop0 bs=2048 count=329453 conv=notrunc,noerror 2>/dev/null | md5sum
  26. cf8b114922fc3fcb0d356825e89b5c49  -
  27. clive@dogmatix > echo "scale=2; (2048 * 329453) / 1024 / 1024" | bc
  28. 643.46
As you can see from the above, the md5sums for the iso file (Line 8) is the same as the md5sums for the cd created (Lines 10, 24 and 26).
You can also see that a straight "dd" command (Line 9) gets the same result as using "dd" with specifying the block size and the number of blocks (Lines 11 - 26).
Lines 25 and 26 are merely there to strip out the unwanted information that was shown in Lines 20 - 24 (It could be redirected to a file instead of /dev/null).
Lines 27 and 28 are just there to show the size of the data on the cd/dvd, obviously there is extra information contained on the cd/dvd that holds the table of contents, data type etc. that makes up the .34 Mb of data difference between the size of the .iso and the cd itself. (Lines 5 and 28)

No comments:

Post a Comment