Using the CD-RW
Overview
This document describes how to burn CDs using the CD-RW drives in the Linux cluster (machines fourier and kepler).
The CD-RW burners currently in CUBINlab are 8x write, 4x re-write. In all examples below, we have assumed a user to be writing CD-R discs, at 8x speed. Replace the required parameter with 4x when writing CD-RW discs.
Getting Access
Before you can use the CD-RW burner, you need to be placed in a cdrw login group. Once you have read and understood this entire guide, see a CUBINlab system administrator who will place you in this group. They may check to see if you understood the contents of this guide, so please do not skim though it!
Writing a CD-R is the same process as writing a CD-RW. There are two major formats in use. The Joliet file system allowing long filenames under MS-Windows, and the RockRidge extensions allowing UNIX filenames and permissions. By default, CDs created under Linux have RockRidge extensions enabled (when using the example commands below). You must specifically enable Joliet should you wish to use the CD-R(W) with long filenames under MS-Windows. It is perfectly OK for a CD to have both Joliet and the RockRidge extensions enabled. See the guide below for the details.
Burning a CD
To create a single session data CD, use the following command (with the CD-R(W) in the drive)
mkisofs -J -r [directory and/or file list...] | \
cdrecord speed=8 -vvv -eject -data -
where the directories and/or files to burn are listed on the command line (wildcards are OK). This will create a CD image (ISO) with both RockRidge and Joliet enabled, while burning the data to the CD at 8x speed. The CD will be ejected from the drive when complete.
To omit the Joliet part of the filesystem, simply omit the -J switch.
Burning multi-session CDs
The previous example simply creates a single (session) track on the CD. Further tracks (sessions) cannot be added, unless the disc is a CD-RW and it is erased. To enable multi-session tracks, you must add a -multi switch to cdrecord. The first track is burnt exactly as above (with the -multi switch):
mkisofs -J -r [directory and/or file list...] | \
cdrecord speed=8 -vvv -eject -data -multi -
Further tracks are a little more difficult. cdrecord needs to know where to start burning (or where the previous track ends). This can be done with the following command,
mkisofs -J -C `cdrecord -msinfo` -r [directory and file list...] | \
cdrecord speed=8 -vvv -eject -data -multi -
where the embedded command cdrecord -msinfo retrieves the required information about the last track on the CD. Again, if you do not require Joliet, remove the -J switch.
To finalise the last track, prohibiting further sessions on the disk, simply remove the -multi switch when writing the last track of the disc.
Erasing a rewritable CD
To erase a CD-RW disc, use the following command:
cdrecord speed=4 blank=fast -eject
As indicated by the command, it erases the disc in "quick mode" - it only erases the TOC. To erase each sector on the disc, use blank=all.
Making an exact copy of a CD
To make an exact copy of a CD, use the following command:
dd if=/dev/cdrom of=/tmp/FILENAME.iso
This command makes an exact ISO copy of the CD currently in the CD-RW drive, dumping it to an ISO file named /tmp/FILENAME.iso. To burn this new ISO CD image to a new CD-R(W), use the command:
cdrecord speed=8 -vvv -eject -data -multi /tmp/FILENAME.iso
where you can omit the -multi if you wish to close the last session.
Note: if you constantly receive I/O errors creating an ISO with dd, you may need to increase the priority of the process -- see an administrator for help in this case.
Further information
This guide only touches on the capabilities of the CD-RW burner. For a more complete guide, see the Linux CD writing HOWTO.