Tell me more ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

How can I clone a CD or DVD to an ISO or DMG, using just the CLI, so that I can attach it to a VirtualBox VM.

I often clone CDs or DVDs using the following commands:

diskname=`df -kh /Volumes/* | grep -o Volumes.* | cut -d"/" -f2`
diskname=`echo $diskname | sed s/\ //g` # remove spaces
device=`df -kh /Volumes/* | grep Volumes | cut -d" " -f1`

sudo umount $device
dd if=$device of=~/Desktop/$diskname.iso bs=2048
hdiutil eject $device

The result is a .ISO on my desktop that is, as far as I can tell, a bit clone of the CD or DVD.

However, when I boot a VirtualBox Windows XP VM and attach the ISO, Windows says it cannot read it.

share|improve this question

1 Answer

up vote 2 down vote accepted

You can use hdiutil to create the disk image, then convert to a hybrid format:

hdiutil create -srcdevice $device $diskname
hdiutil makehybrid -o $diskname.iso -joliet -iso $diskname.dmg

NOTE: this method does not require unmounting the device first.

share|improve this answer
That was it. I forgot Windows needs joliet. Thanks. – mankoff Mar 1 '11 at 9:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.