Creating ISO and Burning CD or DVD using Command Line tools

Creating an ISO image

The command called genisoimage can make an .ISO image to be burned or mounted.

genisoimage -r -J -o image.iso ./directory;

The -r and -J ensure long file names work for Unix (using Rock Ridge) and Windows (using Joliet extensions) respectively.
The -o parameter defines the name of the iso image file to be created (here we used image.iso).
The last parameter (./directory) defines the directory from which the command will copy its files for the image.

Checking CD Images Before Burning

It’s possible to check CD images before burning. The easiest way is to simply double-click on it from the file browser, which will view the image with the Archive Manager.

If you have sudo access, you can also mount the image, and explore its contents using the following commands:

sudo modprobe loop;
sudo mount -t iso9660 -o ro,loop=/dev/loop0 image.iso /media/cdrom;

Remember to unmount an image after checking:

sudo umount /media/cdrom;

Burning a CD on the Command Line with wodim

To burn a data CD (using image prepared earlier), first see where the CD/DVD writer is located using the following command:

wodim --devices;
$ wodim --devices wodim: Overview of accessible drives (1 found) : 
  0  dev='/dev/scd0'     rwrw-- : 'LITE-ON' 'DVDRW SOHW-1633S' 

After finding the info from the device scanning results, take the appropriate target.
This is important if there is more than one device on the system.

In this case /dev/cdrw and /dev/dvdrw both point to /dev/scd0.

$ ls -l /dev/cdrw
 lrwxrwxrwx 1 root root 4 2009-01-26 21:56 /dev/cdrw -> scd0
$ ls -l /dev/dvdrw
 lrwxrwxrwx 1 root root 4 2009-01-26 21:56 /dev/dvdrw -> scd0

Then we can proceed to burn the ISO as follows:

# To burn a data CD
wodim dev=/dev/sr0 -v -data image.iso;
# To burn an audio cd from wav files:
wodim dev=/dev/sr0 -v -audio [wav files...]

Replace /dev/sr0 as needed if this is not your CD/DVD-Writer, the parameter -v (verbose) lets you track the recording progress.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.