Creating CDs

 in
Complete instructions for storing your data on CD.

These days, everyone seems to have a CD writer (CD-R). They are great pieces of hardware, and prices are going down all the time. CDs are great for keeping static data. Your favorite downloads contained on piles of floppies can now be transferred to one CD, lowering your risk of losing the data. With your own CD writer, you can make custom CDs of your favorite Linux distribution, crafted for your needs. You can also make CD archives of your favorite FTP site and pass it along to friends to avoid bandwidth problems.

Choosing and Setting Up Your CD Writer

If you are currently looking for a CD-R, get SCSI. SCSI CD-Rs have been around far longer than ATAPI (IDE) CD-Rs and, as a result, are better supported. However, if you do have an ATAPI CD-R or just can't afford SCSI, don't worry—you can still make CDs.

In order to write with a SCSI CD-R, you must have “SCSI support”, “SCSI CD-ROM support” and “SCSI generic support” compiled in the kernel. Also be sure you have “ISO9660 cdrom filesystem” support. Having “Loopback device support” compiled in the kernel is a good idea, but not required. For this article, I will assume you know how to build your own kernel; if not, refer to the Kernel-HOWTO (see Resources).

ATAPI CD-Rs require a bit more effort. You must have at least kernel version 2.0.35; anything below this requires patches. Recompile your kernel with “IDE/ATAPI CD-ROM support” disabled and “SCSI Emulation support” enabled. Along with these options, you must also enable those options mentioned above (yes, even the SCSI support). The result is your CD-R will look and act like a SCSI device, even though it is an ATAPI. Your CD-writing software also needs to support ATAPI writing; I will discuss this later. Note that when you use SCSI emulation, all IDE CD-ROMs change to a SCSI prefix, so your first CD-ROM would be /dev/scd0.

Required Tools

CD writing in Linux requires two utilities: mkisofs and cdrecord. The first, mkisofs, is required to make an image of the files you wish to burn. Most major distributions come with this utility, but in any case, getting the latest version would be wise. The latest version can be found at ftp://tsx-11.mit.edu/pub/linux/packages/mkisofs/. The second utility, cdrecord, is the software used to burn the image made with mkisofs to a blank CD. You can find cdrecord at metalab.unc.edu/pub/Linux/utils/disk-management, and again, I highly recommend getting the latest version (1.6.1 at the time of this writing). Another utility for burning CDs is cdwrite which can also be found at that URL.

Aside from these, some free and commercial GUI programs for making CDs are also available. X-CD-Roast (see “X-CD-Roast: CD Writer Software” by Thomas Niederreiter, LJ, January 1998) is probably the most famous and is freely available; however, it is based upon the cdwrite utility. There are also X applications which act as a shell and call upon the appropriate utilities to do the job.

Collecting the Files

Once you have the appropriate utilities installed, you can begin to write your own CDs. Before you begin, collect the files to be burned under one directory. I'm going to use the downloading and burning of a Linux distribution as an example throughout this article. First, let's say you anonymously log in to ftp.some_server.com and switch to the directory /pub/linux. This hypothetical directory contains three different distributions; the list output ls looks like Listing 1.

Listing 1. Directory Listing

Assuming distribution_b is the one you want, proceed to download the entire distribution by typing get distribution_b.tar at the ftp prompt. Of course, this directory contains everything you need and nothing else. After all, you wouldn't want to download the distribution for several different architectures. Thus, when you download an entire distribution, make sure you go deep enough into the directory to get only what you need. For example, if you wanted to download the entire Red Hat distribution for the i386 architecture on ftp.cdrom.com, you would download everything in the /pub/linux/redhat/redhat-6.0/i386 directory and below.

Once the download is finished, create a directory for storing the files. In this example, I'll create a directory called cdimage, then place the contents of distribution_b.tar into that directory by executing the following commands:

mkdir cdimage
tar vxf distribution_b.tar -C cdimage

Since the verbose (v) option is requested, the contents of distribution_b.tar will fly by on your screen and its contents will be located in cdimage. If everything went well, you can now delete distribution_b.tar to save space.

If you want to burn some collection of files other than a Linux distribution, just place them in the cdimage directory.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix