Write DVDs with Common Linux Tools

Author:

Dimitry Dukhovny

Especially in government, CDs and DVDs are still in circulation.

Check the state of all inserted CDs and DVDs

1# Install the cdrskin if it is missing
2for drive in /dev/sr*
3do
4    cdrskin dev=${drive} -minfo 2> /dev/null
5done

Pay special attention to the “disk status” line. It will tell whether the disk is finalized or closed against further writing.

This is the same as “fixed,” “fixated,” and “finished” in various documentation.

What the “disk satus” means:

Status

Meaning

empty

Blank disk inserted

incomplete/appendable

Disk with content, but not closed

complete

Disk closed, possibly with content

Create an ISO

In this example we will write the contents of /home/user/myimage/ to /home/user/myimage.iso and label the image “MYIMAGE.”

1# On Debian systems, use genisoimage ...
2genisoimage -JrV MYIMAGE -o /home/user/myimage.iso /home/user/myimage/
3# ... or xorrisofs
4xorrisofs   -JrV MYIMAGE -o /home/user/myimage.iso /home/user/myimage/
5# On Redhat-like systems, use mkisofs
6mkisofs     -JrV MYIMAGE -o /home/user/myimage.iso /home/user/myimage/

Mount an ISO

We will mount our new image, /home/user/myimage.iso to a directory we will create for this purpose.

1mkdir /home/user/imagemount
2sudo mount -o loop /home/user/myimage.iso /home/user/imagemount

If this fails, the loop module may be absent. This is improbable, but imaginable.

To fix that…

1sudo modprobe loop

Burn an ISO to CD or DVD

This is the easy part. This version of the command writes /home/user/myimage.iso to /dev/sr0.

Without the “dev=” option, wodim still tries to guess the best drive for the job. It finalizes the disk by default.

1wodim -v -eject dev=/dev/sr0 /home/user/myimage.iso.

Make an ISO Boot from USB Drive

This command write myimage.iso to a USB disk inserted as /dev/sdb.

1dd if=myimage.iso of=/dev/sdb bs=1024k status=progress