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.
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.
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.
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.
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.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- SUSE – “Will not diverge from its Open Source roots!”
- Dealing with Boundary Issues
- Vagrant Simplified
- Libreboot on an X60, Part I: the Setup
- October 2015 Issue of Linux Journal: Raspberry Pi
- System Status as SMS Text Messages
- Bluetooth Hacks
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- New Products
- October 2015 Video Preview