I experienced much frustration searching the Internet for simple examples about how to generate optical disks with Linux using its native console utilities, so I decided to list my discoveries here, in order to benefit the Linux Community. For people who are new to Linux, it is important to remember that anything that can be done from a standard Linux console can also be done from an x-term (x-terminal), so there is no need to leave the windowing system.
Find Your Drive
Since Linux uses typical Unix-style naming conventions, you will find the needed pointer to your drive located in the /dev directory. For most people, the first (and only) optical drive will be named '/dev/sr0'. Any second optical drive (if it exists) will have its naming number incremented, such as /dev/sr1. With older hardware (ie. IDE drives), the name of the first optical drive will usually be /dev/hdc0, with the same pattern for incrementing the trailing number for all additional optical drives.
You can usually find the location of your drive by running: wodim --devices. Most modern Linux distributions automatically create links called '/dev/dvd' and '/dev/cdrom' to the proper device. Therefore, the proper device can sometimes be found by executing the 'ls -l' command for either '/dev/dvd' or '/dev/cdrom'. Notice the command uses a lower case 'L'. It is not an 'i' or the number '1'. When I used 'ls -l /dev/cdrom', this was the output from my system:
Eureka! The link is shown to be pointing the the real device name, which is /dev/sr0.
In all of the examples below, /dev/sr0 should be replaced by your actual CD/DVD device name.
Formatting the Disk
This process is only necessary for rewritable CDs that already contain data or media. Standard CDs and DVDs are already formatted when you buy them. Formatting will eliminate the contents on the disk and prepare it for reuse.
Making Audio CDs
To make an audio CD that will play back in a standard CD player, you need to first convert your files to the CDA or WAV format.
The easiest way to do this from MP3s is through the use of the 'mpg123' program via the following command.
Notice that the output (new) file is listed before the input (original) file. This is a quirk of the mpg123 program, whereby the usual parameters are given backwards, in the case of file conversions.
To make WAV format files from all of the MP3 files in a directory, use:
Then, run the following command to burn all of the WAV files in your directory. Change the location of the CD-ROM drive (/dev/sr0) if necessary.
Burning Movies onto DVDs
Movies must first be in an ISO Image before they can be burnt to disc. An ISO Image is an archive file that contains a directory structure.
Burning a Directory onto a CD
The following command is the most hassle-free way to burn a directory on to a CD. The 'mkisofs' utility is already installed for most Linux distributions. You can also use this method to burn music files onto a data CD for computer-only play back.
Burning a Directory onto a DVD
This command is great for creating DVD back-up archives. This is not used for media DVDs.
Burning an ISO onto a CD
Live CD or installation ISO files (*.iso) are often provided by Linux distributions. They can be burnt with cdrecord.
Burning an ISO onto a DVD
For large data ISO files (greater than 700MB), such as is common with modern operating systems, use the 'growisofs' utility to create the DVD disk from the ISO image file.