Image of the glider from the Game of Life by John Conway
Skip to content

How To Properly Create And Burn CD/DVD ISO Images From The Command Line

Too often, I see the recommendation on forums, IRC, and elsewhere across the internet to use improper tools for creating ISO images. For example, consider the following two commands, both of which are not the correct way to build a CD/DVD image:

$ dd if=/dev/scd0 of=cdimage.iso # NO!

Or worse yet:

$ cat /dev/scd0 > cdimage.iso # NO!

As you are probably thinking, the problem with the two commands above, is that they provide no error checking while building the image. So, in order to make sure you have all the bits, you need to use another tool, such as using the MD5 hashing algorithm:

$ md5sum /dev/scd0 cdimage.iso
d642d524dd2187834a418710001bbf82  /dev/cdrom
d642d524dd2187834a418710001bbf82  cdimage.iso

Thankfully, the hashes above match. But, what if they didn't? Then, you get to redo your dd(1) command (or, shudder, cat(1)) from above, and then rerun md5sum(1) to make sure you got all the bits. Doesn't sound like much fun to me. Thankfully, there is a better way, one which handles the checksum while doing the copy.

You want to use readom(1) ("read optical media") from the wodim(1) ("write optical disk media") package. Consider the following command:

$ readom dev=/dev/scd0 f=cdimage.iso # YES!

If readom(1) fails to get the bits during the copy, it will let you know that it's struggling. If it got all the bits, you know you have them all, because of the error checking during the copy. Sure will save you a lot of time running manual hashes when finished.

Now, what about burning a copy of the ISO image? Surely you use dd(1), yes? Something like:

$ dd if=cdimage.iso of=/dev/scd0 # NO!

NO! Instead, use wodim(1) directly:

$ wodim -v -eject cdimage.iso # YES!

For the same reasons that you want to use readom(1) for creating ISO images from CD/DVD, you want to use wodim(1) for burning ISO images to CD/DVD. What happens if after using dd(1) to create your CD/DVD, the md5sum(1) hash doesn't line up with the image? You didn't get all the bits, and created a coaster. Use wodim(1) and should it succeed, you can rest assured that you have all the bits.

So, remember, readom(1) and wodim(1) are the tools you want when creating and/or burning ISO images from the command line. Any other tool, and you're likely doing it wrong.

{ 3 } Comments

  1. Jan Gutter using Google Chrome 14.0.835.186 on GNU/Linux 64 bits | September 27, 2011 at 1:39 am | Permalink

    Sorry to burst your bubble, but it turns out that it's actually:

    $ wodim -v -eject cdimage.iso # NO!

    $ wodim -v -eject padsize=63s -pad -dao cdimage.iso # YES!

    Why the padding? Turns out that a lot of distributed .iso's haven't been created with proper padding (I'm looking at YOU, Ubuntu!). -dao and padding helps with CD drives can't handle data that ends abruptly. For more info, check out:

    http://www.troubleshooters.com/linux/coasterless.htm

  2. Dominik Honnef using Google Chrome 14.0.835.163 on GNU/Linux 64 bits | November 27, 2011 at 11:18 am | Permalink

    Shouldn't the DVD drive itself, and thus the drivers in the kernel, take care of detecting errors in the first place?

  3. Dinar Qurbanov using Firefox 3.6.17 on Ubuntu | November 29, 2011 at 5:31 am | Permalink

    hello. how to correctly calculate md5 of cd, (to compare it with md5 of iso file?) there are 2 methods in https://help.ubuntu.com/community/HowToMD5SUM#Check_the_CD . do not you know better way?

Post a Comment

Your email is never published nor shared.

Switch to our mobile site