0

Basically what I would like to do is to verify that an image has been burned successfully. It's pretty much the same question like this, except for Mac OS X.

After searching online (including superuser.com) I could only find solutions to my problem for Windows and I would like to solve this problem on Mac OS X.

I already tried to install ImgBurn via Wine but that doesn't seem to work.

comfreak
  • 1,253

4 Answers4

3

The best way to go about this sort of comparison on is the cmp command. cmp compares data byte-by-byte and will inform you of any difference** between the two files.

Enter the command as cmp /home/image.iso /media/cdrom0 (make sure to use the actual paths to the image and the CD as appropriate for your situation). The output you want to see is either no output (the image and the CD are identical), or cmp: EOF on image.iso, which indicates that there are more bytes on the CD than the image, but all of the data on the image was successfully copied to the CD. The extra data on the CD is probably just padding with zeroes, which occurs when the image is smaller than the size of the CD.

On the other hand, if you see an output informing you that the two differ (it will look something like image.iso cdrom0 differ, byte 128 line 7), then there was an error when copying the image and there is some difference between them. The other thing you might see that would not be good would be cmp: EOF on cdrom0, as this indicates that part of the image was not copied to the CD (this could be the result of an interruption in the copying process).

As a side note, I would guess that the reason you're seeing a different shasum for each file is because of that zero padding at the end of the CD, which will change the shasum but won't affect the functionality at all.


** Technically, cmp only reports the first difference between the files. If there are multiple differences, it won't show them, but for the case of burning an image to a CD the number of errors shouldn't matter, any errors are bad.

0

I'm not a Mac user myself, but after doing a bit of snooping, it would seem that this is supported natively in OS X, thanks to the Disk Utility application. Details here: http://www.macinstruct.com/node/390

This article is from 2011, and like I said I'm not a Mac user myself so I don't have one on hand to check, but if Disk Utility still exists this option is probably still there.

0

If you are not afraid of "the dark side" of OSX i.e. use a terminal for that you can simply compare the SHA checksums of the raw device and the image file.

$ shasum /dev/rdisk2
bad2c8fbb090a4b49b63135895fdb3b64062ceb6  /dev/rdisk2
$ shasum yourdisk.iso
bad2c8fbb090a4b49b63135895fdb3b64062ceb6 yourdisk.img

and compare the output.

kasi
  • 1
0

Assuming bash scripting is available

Copy the bash-script below as 'cksum.sh' into a folder that is included in your $PATH
Type chmod 755 cksum.sh (within the folder you saved the script in)

Then to use it; cd into the folder with the original files, and do:
$ cksum.sh -b to create a 'CONTENT.sha256sum' file.
$ cksum.sh -c to check the checksums in the file against files in the current dir.

You may also provide a filename for the checksums as a second argument, to override the default, which is always created in/read from the current working dir (note: excluded from the checksum file).

This is most certainly slower than many other solutions, but I believe it is more versatile than others. Note also that if you leave the checksum file on the media (be it CD, DVD or USB) then checking the media content is a simple
sha256sum -c CONTENT.sha256sum
at any time, assuming you have the sha256sum executable.

It detects faulty and missing files, but not 'added files' (as written); but that is possible by matching the folder content to the list content.

The end user may also detect faulty (e.g. read errors) and replaced files by finding the sha256sum executable and using sha256sum -c CONTENT.sha256sum.


--- cksum.sh ---
#!/bin/bash

file="$2"
file="${file:=CONTENT.sha256sum}"

case  "$1" in

  "-b" ) 
    ( find -type f ! -iname "*$file" 2>/dev/null   \
     | while read f ;do sha256sum -b "$f" ;done )  \
     | tee "$file"
  ;;

  "-c" )
    if [ ! -r "$file" ] ;then
      echo "'$file' is not a readable file, cannot check."
    else
      sha256sum -c "$file"
    fi
  ;;

  * )
    echo "Usage: ${0##*/} -b|-c [checksum-filename]"
    echo "Will create(-b)/check checksums in '$file'"
    echo "for files in current dir,"
    echo "by use of 'find -type f' and 'sha256sum -b/-c'"
  ;;

esac
Hannu
  • 10,568