WRITE A CD BEFORE CREATING AN ISO

Most people who burn CDs under Linux will first create an ISO image. Most downloadable Linux distributions include ISO images. Simply download the ISO and burn it to a CD.

There are many tools, such as mkisofs, that help create an ISO image and then burn it to a CD. However, this is problematic on systems with little space, because backing up 650 MB of data on a CD requires 650 MB of temporary space to store the ISO.

If you have a CD burner and a fast host computer, you can avoid this by burning directly to a CD. For example, you can copy from one CD-ROM to your CD writer by using this command:

$ dd if=/dev/hdb | cdrecord -v -speed=12 -dev=0,0,0 -fs=8m -data -

This uses dd to read in the contents of /dev/hdb--your CD-ROM with a CD in the drive--and pipe it into the cdrecord program. The program then writes to the device 0,0,0. To determine the device number of your burner, use cdrecord or scanbus.

The -fs command tells cdrecord to make the write FIFO a little bigger than the default, which helps to offset possible small slowdowns. Finally, the -data - command tells cdrecord to read the data from STDIN, the location from which the dd information is coming via the pipeline.

You can also create an ISO with mkisofs but make it write to STDOUT instead of to a file. This skips the space requirements for a temporary file, and it's useful if you're backing up your home directory or some other set of files on the local hard drive. Using dd works only with small partitions or CD-ROMs.

Before you use mkisofs to create an ISO, make sure the size of that directory will fit onto a single CD. Here's how:

$ mkisofs -r /home/joe | cdrecord -v -speed=12 -dev=0,0,0 -fs=8m -data -

This command tells mkisofs to make an image of /home/joe and write it to STDOUT instead of to a file, which gets piped as STDIN to cdrecord.