Linux (Ubuntu) make an ISO image of a CD or DVD in one step


Two frequent recommendations made online for creating ISO images are to use dd or cat e.g. For example:

dd if=/dev/cdrom of=cdimage.iso
OR
cat /dev/cdrom > cdimage.iso

Neither are appropriate to create an image of CD or DVD.
  1. They provide no error checking and require a hash checksum such as MD5 or SHA1 to verify the image created is true to the original media; and
  2. Neither dd or cat lock the underlying files so there's a risk they could change whilst the image is being created.

Use readom...

Readom (“read optical media”) is part of the wodim package. It performs error checking during the copy/imaging process and if it fails during a copy it will let you know. The command is simple:
readom dev=/dev/cdrom f=cdimage.iso

# Eject (open) the cd drive
eject cdrom

# Eject (close) the cdrom drive
eject -t cdrom

# Create the image
readom dev=/dev/cdrom f=/cdimage.iso

A further notable down side to using dd is that it does not create a sparse image i.e. it copies all of the blank space from the source disc too.

For the same reasons that you would use readom for creating an image, you shoud use wodim for burning the image back to CD or DVD again it's a simple command:

# Burn the image
wodim -v -eject cdimage.iso

4 comments:

  1. If using Ubuntu, remember to un-mount your DVD drive first!

    #umount /dev/dvd
    #readom dev=/dev/dvd f=dvd.iso

    ReplyDelete
  2. Nice improvement over using dd! Thanks for this.

    ReplyDelete
  3. and if you are imaging a hard drive to an iso, read optical media sounds like CD/DVD to me , last time I checked my hard drive was just a bunch of really tiny magnetic bits on a silver platter..

    ReplyDelete

Note: only a member of this blog may post a comment.