Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: Automate the creation of ISO images System 10.6
Snow Leopard only hintI love Disk Utility, however, it does not directly support the creation of ISO 9660 images. It can create CDR images or CD/DVD master images. Those can be renamed to .iso files and are supported by most software. But that's inconvenient to say the least.

Some searching revealed that you can create ISO images using the Terminal through hdiutil.

The Terminal command is:
hdiutil makehybrid -o ~/Desktop/Diskimage.iso ${diskName} -iso -joliet

However that still leaves things complicated. So I put this in Automator by adding the 'Run Shellscript' action.
echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
echo "Starting ISO creation" >> ~/iso.log

diskName=$(drutil status | grep "Name:" | awk '{print $4}')

echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
echo "Device: ${diskName}" >> ~/iso.log

echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
echo `diskutil umountDisk ${diskName}` >> ~/iso.log

echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
echo "Starting copy action."

echo `hdiutil makehybrid -o ~/Desktop/Diskimage.iso ${diskName} -iso -joliet` >> ~/iso.log

echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
echo "Done" >> ~/iso.log
This script finds the superdrive by drutil, then unmounts the disk by diskutil, then makes the actual iso image by hdiutil and logs the process in a log file in the user directory.

I made this a Service in the Application menu (Snow Leopard only). Now I run the Service and the disk image appears on my desktop, when the CD/DVD ejects, it's done.

[crarko adds: The original command with hdiutil was mentioned previously in this hint. The use of Automator to create a Service is a handy addition to that.]
    •    
  • Currently 2.36 / 5
  You rated: 5 / 5 (33 votes cast)
 
[9,000 views]  

10.6: Automate the creation of ISO images | 4 comments | Create New Account
Click here to return to the '10.6: Automate the creation of ISO images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Automate the creation of ISO images
Authored by: kylecara on Jul 30, '10 06:24:17PM

I'll try it & see. Should work like any other disc image.



[ Reply to This | # ]
10.6: Automate the creation of ISO images
Authored by: theosib on Jul 31, '10 09:46:03AM
On Linux, I can make an ISO by doing this:
cat /dev/sr0 > mydisc.iso
This is because the contents of the disk is bit-for-bit the same as the ISO file that was burned to it. In other words, an ISO is just an image of the disc. (You can use dd to do the copy too, and probably also cp, although I'm not sure.) I'm sure that MacOS X can do the same. Pop in a disc, type "mount" to see what device the volume is mounted on, and then cat the device to a file. (Since it's read-only, you should be able to have it mounted and also copy it at the same time.)

[ Reply to This | # ]
10.6: Automate the creation of ISO images
Authored by: Typhoon14 on Jul 31, '10 06:18:07PM

The hint about using "cat" actually works well (it does appear to have be be unmounted though [use diskutil unmount /dev/diskid]).

That said, it is a bit different. The original hint seems to be aimed at generating disk images that are fully standards-compliant ISO 9660/Joliet. The cat method will generate a sector-by-sector copy of the original media, but does not guarantee that it will be at al ISO-compliant.

That said, the original hint seems to guarantee ISO-compliance even if it means creating a copy that is different from the original. I'm not clear on why you would actually want to do this. A sector-by-sector copy of a disc with the .iso extension and any ISO 9660 variant or even a UDF filesystem works perfectly in most Disk Utilities on Mac, Windows, or Linux.

Another note regarding the "cat" method. It appears to be exactly what Disk Utility does when you Choose "CD/DVD Master" as the format. The original hint mentioned that doing this was cumbersome, but I don't really see how do this and change the extension to .iso and you will have an image that is every bit as ISO compliant as the source disc.



[ Reply to This | # ]
10.6: Automate the creation of ISO images
Authored by: scifiman on Aug 02, '10 10:09:00AM
Another note regarding the "cat" method. It appears to be exactly what Disk Utility does when you Choose "CD/DVD Master" as the format. The original hint mentioned that doing this was cumbersome, but I don't really see how do this and change the extension to .iso and you will have an image that is every bit as ISO compliant as the source disc.
This is correct. A .cdr "CD Master" is just an .iso with a different extension. Change it to iso and burn away.

[ Reply to This | # ]