How to Cut a CD under Linux at the AHPCC
A CD-R is a CDROM drive that also is capable of writing WORMs (Write
Once, Read Many). These WORMs are then readable by a standard CDROM drive.
The AHPCC has an HP6020i double speed CD-R writer available for
use in AHPCC projects. It can write CDs in an hour or so (depending
on data size) and is capable of writing audio, data, photo-CD, or mixed
format CDs. The unit is currently installed in artesia, one of the AHPCCs
Linux PCs.
Under Linux (so far) only CDROM (data) images are supported. Anybody
that discovers how to do audio or any of the other formats the drive is
capable of is welcome to document the process and it will be included
here. The other image formats are supported under Windows 95, but that
is outside the scope of this document.
CD images are generated by the program mkisofs. This program
takes a directory structure and creates a single file with the entire
CD image inside, including the ISO 9660 format (ISO 9660 is the international
standard file system for data CDROMs). After the image has been generated
the CD is cut off of that image using the program cdwrite.
The image file produced by mkisofs must be stored locally on
artesia. This is because during the cutting process there must be an uninterrupted
flow of data to the CD writer. If the flow is interrupted the CD will
be corrupted and be unusable. This is also the reason we don't just pipe
the output of the mkisofs program directly to the CD writer.
This document is intended as the quick-start, get-the-job-done-now-with-a-minimum-of-fuss
method. If you want more detail, and a better understanding of how to
use the CD writer, or you want to know more about the subjects just touched
upon here, please read the Linux CD Writing
mini-HOWTO.
Before You Begin
In order to "cut" or "burn" a CD you must have a blank CD-R disk. You
must also have exclusive use of the machine (i.e., no one else should
be logged on or, at the very least, not doing anything significant).
Generating an image
Artesia has space set aside on the local hard drive to develop images.
The initial image does not have to be on artesia, but the iso9660 image
created by mkisofs must be local to artesia. This is to ensure
that there is an uninterrupted flow of data to the CD writer. In any case,
there should be enough room in the directory
on artesia to both develop then image the CD.
Gathering the files
In order to make a CD, you must make a directory structure that looks
just like the directory structure you will be writing to the CD. For example,
when I built the Debian installation CD, I copied the entire Debian mirror
to
on artesia. Unfortunately, this is about 1.2 Gb of information... a CD can
only hold approximately 650 Mb. So I trimmed. I finally got an image I
could use that was about 600 Mb. You should make a directory in /cdimaging/scratch
on artesia and put the files you want on the CD in there. This will avoid
confusion if others are also trying to build images.
Trust me, gathering the files is the most time consuming part of the
process. Be sure you have everything you want, since once you cut the
CD, you can't add anything else :-).
Create an iso9660 filesystem
To create the image that will be cut onto the CD you must execute the
following command:
where -r sets the permissions of all files to be public readable
on the CD and enables Rock Ridge extensions (a system for writing
Unix filesystems, especially Unix filenames, on standard CDROMs), -k
fixes a bug in the Linux kernel and prevents the last file on the
CD from being "destroyed" (not really, but Linux can't read it),
-o cd_image.img is the output flag and the name of the output
file that you want the image written to, and private_collection/
is the directory where the CD data has been gathered (in the previous
step).
The output file should be placed in the directory
on artesia.
So, for example: In order to create an image for my Debian installation
CD, I used the commands
which built the image file Debian_install.img from the files
I had gathered in the Debian_install/ scratch directory.
You will probably get a whole mess of messages describing how mkisofs
is trying to map your files into 8.3 format. Don't Panic! By using
the Rock Ridge extensions you will never see the 8.3 format while you
are using Unix. But it also means the CD can be read by an MS-DOS
machine, as well.
In case you haven't already guessed, the image produced by mkisofs
is the same size as the collection of files that went into it. So you
must be sure you have enough space to accommodate both. If not, you might
try gathering the files on some other machine, then nfs mounting that
collection to artesia. We won't go into how that's done here.
Test the CD image
Before you go any further you should test the image you just made. Linux
has the ability to mount files as if they were disk partitions. You can
use that here to check and see if the layout of your CD image is OK.
To mount the file you created above on the directory /cdimagetst,
give the command
mount -t iso9660 -o ro,loop=/dev/loop0 cd_image.img /cdimagetst
where cd_image.img is the name of your image file. This will
mount your image file under the directory
on artesia. The unfortunate part of this is that (at least for now) you
must be root user in order to make use of this feature. But, you must
also be root user to cut the CD, so you might as well do it now.
For obvious reasons the root passwords aren't published here... you will
have to get someone who knows the password to log in as root for you.
Your best bet is John Barnes or Ken Summers.
Look your image over and make sure it has everything it is supposed to,
where it is supposed to be. When you are done give the command
to unmount the image.
Cut the CD
The moment of truth has arrived. Be sure no one else is using the machine.
It is extremely important that the machine not be distracted while trying
to cut a CD. If the dataflow stops even for a moment the CD will
be corrupted and be useless (well, not entirely useless: they make cool
frizbies, although they don't fly very well). To check for usage just
type "w" at the unix prompt. This will give a list of all the people logged
on to the machine, as well as the machine load. If somebody else is on,
well, you'll have to go find them and negotiate an understanding, capish?
The simplest way to keep somebody from loging in in the middle of your
run is to unplug the ethernet cable from the wall. This has some unpleasant
side effects, but nothing harmful. Just remember to plug it back when
you're done!
Before you actually cut the CD I would strongly recommend that
you test the burn first. The test performs all of the IO, moves the drive
head, does everything it would during the actual burn, but leaves the
laser off. This allows you to see if you are able to cut at the speed
you want, see if the image actually fits on the CD, and a host of other
things.
In order to cut the CD you must be logged in as root. John Barnes or
Ken Summers can accomplish this magical feat for you.
To run the test, put your blank CD-R in the drive (the HP one),and give
the following command:
cd /cdimaging/images
cdwrite -vy cd_image.img
where cd_image.img is the name of your image file. The -vy
causes a verbose test output.
If your test run finishes successfully (after a long while: better go
find something else to do in the mean time) you can issue the command
where cd_image.img is the name of your image file and the -ev
causes verbose output and causes the tray to be ejected when the job is
done (this is a wonderful visual cue that it finished).
Now pop that disk into a CD drive, mount it up, and see what you
have wrought!
Return to the Albuquerque High Performance
Computing Center
|