Creating CDs

Complete instructions for storing your data on CD.
Creating the CD Image

Remember when creating CDs, the root of the CD is relative to the created directory; in this case, cdimage. Once you have your files in this directory, you are ready to create the iso9660 image using the mkisofs command. To create the basic image, use the following command:

mkisofs -r -o cdimage.iso cdimage

The -r option ensures the image contains additional file description data by way of the Rock Ridge protocol, preserving the original file name and setting permissions optimally for CD-ROMs such that read/execute permissions become global, write permissions are cleared, and special mode bits are also cleared since they do not apply on CD-ROMs. The -o option designates the output file (cdimage.iso). The last value is the directory in which the files are located.

Many commercially manufactured Linux CDs, such as Red Hat, are bootable. This isn't difficult to do using the “El Torito” standard. Most newer BIOSes today support the bootable CD feature, and most bootable CDs for the PC are based on El Torito. El Torito makes your CD appear as a floppy, and thus your BIOS can boot it.

If you want a bootable CD, you'll need a 1.44MB boot image intended for a boot floppy. In our distribution example, we could use the boot image used for installation. For distribution_b, the name of the boot image is boot.img. The process by which we make a CD bootable takes place in the creation of the iso9660 image (International Organization for Standardization specification for compact disk read-only memory). Thus, before we create our image, we need to create a directory inside of cdimage to hold the boot image; a directory called boot would work fine. So, we place the image boot.img into cdimage/boot and create the iso9660 image by executing the following command:

mkisofs -r -b boot/boot.img -c boot/ -o\
   cdimage.iso cdimage

Here we have two new options, both of which are used to make the CD bootable. The -b option is followed by the name of the boot image to be booted. Note that the file is relative to the root of the CD. The -c option is followed by the name of the boot catalog required by El Torito; this file is automatically created by mkisofs. Only the more recent versions of mkisofs allow for the automatic creation of the boot catalog; older versions require you to create it yourself.

Before actually burning the CD, take a look at your image layout by mounting it. This is done using a loopback device, so this must be supported in the kernel. The following command will mount your image:

mount -r -t iso9660 -o loop cdimage.iso /mnt
Burning the CD

Once you've created your image, bootable or not, you are ready for the final process of burning it onto the CD using either cdrecord or cdwrite. Take the following into consideration before you start:

  • Make sure the computer isn't experiencing any excessive vibrations.

  • Make sure the image is on a local hard drive.

  • Make sure the load on your system isn't too high.

Keeping these three things in mind will help prevent errors during the write process. The CD writer can be put through a test process that won't actually write, but will simulate the entire process. This is done by adding the -dummy option for cdrecord and the -y option for cdwrite. Now all that is left is inserting a blank CD and executing the command that matches your choice of writer.

cdrecord -eject -v -isosize speed=2 dev=0,0\
cdwrite -ev --device /dev/??? -s 2 cdimage.iso
The first two options for both utilities are eject and verbose. Thus, the CD will eject after the burning process is finished, and the program will run in verbose mode. The option -isosize for cdrecord limits the size of the CD to the size of the iso9660 image. The options speed=2 and -s 2 indicate the speed at which to write to the CD; in this case, the 2 means at 2x. Finally, the options --device, dev=0,0 and /dev/??? set the target device, where /dev/??? should be your CD-R (i.e., /dev/scd0) and 0,0 stands for the SCSI ID and bus in that order.


If all worked out well, congratulations. You now have a full-fledged, iso9660 CD. You can make a CD with other formats just as well. The utility mkhybrid, included with mkisofs, can make images of Joliet and HFS format. It is also possible to make a CD with the EXT2 file system format. Have fun burning!


Alex Withers has been using Linux since 1.1.59. He is currently studying computer science at Gonzaga University and can be reached at


White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState