Creating ISO Images from the OSX Command Line

A super fast way to create ISO images (or any kind of bit for bit copies) from the OS X (or linux, or unix) command line is to use the DD command. This isn’t without it’s risks since the DD command will duplicate byte for byte all data from one location to another, but once you’ve found the necessary information you can easily replicate data.

I needed to create a copy of my Windows XP installation CD to use for setting up new virtual machines. Since it’s quicker to install VMs from an ISO image rather than from the installation media I wanted an ISO of my CD. The built in OS X disk utility can make this work… in theory. My copy of disk utility (on Snow Leopard) didn’t want to recognize the CD. So I turned to my command line knowledge.

I should also note that before you can read the CD using DD, you will need to unmount it:

`sudo umount /dev/disk1s0`

You’ll be prompted for your administrator password, then you’re in business.

To create an image of a CD (or DVD or anything else…) use the following:

`dd if=/dev/disk1s0 of=/Users/kdmurray/Desktop/WindowsXP.iso bs=64k`

* if= input file, in this case our Windows XP CD
* of= output file, the actual ISO file you want created
* bs= block size, the size of chunks the tool will work with
I did a few speed tests at 16k, 32k, 64k, 128k, 256k and 1M and found that the 64k seemed to be the ideal block size on my machine. This will vary by CPU, and possibly by hard drive controller, so do a few contolled tests first. To do a test, start the copy process, then stop it after 20-30s (ctrl-c). Whichever one copied the most in 30s is the one you should use.

That’s all she wrote, folks. Happy command-lining. 🙂