This next article will show you, the reader, how to make use of your precious cd-writer without resorting
to some fancy gui application (alhtough Xcdroast and K3b are very nice). You will be burning from the command line.
To burn cd's on a Linux box, we will use the venerable cdrecord. Cdrecord is known to work on
almost any OS (Linux, FreeBSD, NetBSD, Solaris, IRIX, . . . ) and on nearly every cd-writer.
If it is not installed yet on your Tux-box, either install the package from your distro or get the source
here or
at the official site. It's part of the cdrtools package.
To avoid problems on a Linux system with kernel 2.4.x, you better enable SCSI emulation for your ATAPI cd-writer
(like most people have).
Have a look at the CD-Writing-HOWTO to find out how
to do this.
On Linux systems with kernel 2.6.x however, you no longer need SCSI emulation to use cdrecord with an ATAPI drive.
To burn cd's on a FreeBSD machine, you can use cdrecord for SCSI or USB writers, and burncd for
ATAPI-drives. The latter should be installed by default on your BSD machine.
Burncd can work with plain ATAPI cd-writers without needing addtional SCSI emulation.
Here is a list (although outdated) of drives known to work with burncd.
When using cdrecord to burn cd's, run
cdrecord -scanbus, like this :
# cdrecord -scanbus
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
scsibus0:
cdrecord: Warning: controller returns wrong size for CD capabilities page.
0,0,0 0) 'LITEON ' 'CD-ROM LTN382 ' 'UL2B' Removable CD-ROM
0,1,0 1) 'PLEXTOR ' 'CD-R PX-W1610A' '1.05' Removable CD-ROM
0,2,0 2) *
. . .
0,7,0 7) *
|
In this case, the cd-writer is device 0,1,0 (the Plextor drive). This applies to
Linux (kernel 2.4) and BSD with SCSI drives. On Linux with kernel 2.6.x, you can simply use
/dev/hdc or whatever device represents your cd writer (check dmesg).
On FreeBSD, when using burncd, check dmesg to find out the device name of your cd-writer.
The default is /dev/acd0c.
Next examples show you how cdrecord and burncd can be invoked to perform some common
tasks like burning an iso image, an audio cd or blank a cdrw. Not all options used here
may apply to your cdwriter.
- with CDRECORD :
- burning an ISO image :
My Plextor drive supports the Burnproof technology, so I may as well use it. The "-data" option
is not needed, since it's the default. Cdrecord uses a standard memory buffer of 4MB. If you want
to use more, add the fs=Xm option, where X specifies the number of MB's.
# cdrecord -v dev=0,1,0 speed=12 driveropts=burnfree -eject -data i386cd.iso
- burning an audio CD :
First make a collection of .wav files (44KHz, 16 bit stereo). This can be done by ripping tracks
from other audio discs with cdparanoia or cdda2wav. Then burn them like this :
# cdrecord -v dev=/dev/hdc speed=4 driveropts=burnfree -eject -audio *.wav
- blanking a CDRW :
To perform a fast blanking (data is not overwritten, only minimal blanking is done), use this :
# cdrecord -v dev=0,1,0 speed=10 blank=fast
To perform a full blanking (erase the entire media, can take quite some time), use this :
# cdrecord -v dev=0,1,0 speed=10 blank=all
Note that not all drives support blank=fast. It may then be necessary to use blank=all.
- with BURNCD :
- burning an ISO image :
# burncd -f /dev/acd0 -v -e -s 12 data i386cd.iso fixate
- burning an audio CD :
# burncd -f /dev/acd0 -v -e -s 6 audio *.wav fixate
- blanking a CDRW :
To perform a fast blanking (data is not overwritten, only areas that make the media appear
blank for further usage are erased), use this :
# burncd -f /dev/acd0 -s 10 blank
To perform a full blanking (erase the entire media, can take quite some time), use this :
# burncd -f /dev/acd0 -s 10 erase
Contrary to cdrecord, burncd doesn't give you a 10-second delay to bail out.
It starts blanking immediately. The eject option (-e) doesn't seem to work (or apply ?) when
blanking a CD (if you ever wondered why it's omitted in the blanking examples).
··
Making a copy of an existing CD
To get a 1:1 copy of a data CD you wish to copy, type this :
# dd if=/dev/cdrom of=/tmp/cdimage.iso
|
This will produce an ISO image, cdimage.iso, stored in /tmp, ready to burn to a cd.
··
Creating an ISO image yourself
When you want to create a data cd, you will need to make an ISO filesystem before you can
burn the file to a cd-r(rw). This process, the premastering, is done with mkisofs.
Needless to say you have to make sure you have enough free diskspace available to store both
the image tree and the image itself (so, you'll need at least 2x the space).
mkisofs produces an ISO 9660 file system that is an image of a directory tree in a Linux/Unix file system.
The simplest usage is:
# mkisofs -r -o imagefile.iso /path/to/tree
|
The "-r" option sets the permissions of all files and dirs to be public readable and enables the
RockRidge extensions (allowing long filenames). This command will thus create a file called imagefile.iso
containing an ISO 9660 file system with RockRidge extensions that is a copy of the tree at /path/to/tree.
You can then burn the imagefile as shown above. If you want to test the file to check the layout, you
can mount it first, like this :
# mount -t iso9660 -o ro,loop=/dev/loop0 /mnt/cdrom
|
You can then inspect the files by cd'ing to /mnt/cdrom. To unmount, just issue unmount /mnt/cdrom/.
Your Linux kernel needs support for so-called "loopback" devices to be able to mount an ISO image like this.
··
Creating a bootable CDROM
You will need an image of a bootable disk, like a bootable DOS-floppy or Linux bootdisk, to create an
El Torito bootable CDROM. Create such an image from a floppy like this :
# dd if=/dev/fd0 of=bootimg bs=18k
|
You can then create a bootable ISO image like this :
# mkisofs -b boot/bootimg -r -o imagefile.iso /tmp/img_tree
|
given that /tmp/img_tree holds the filesystem you want to burn, and bootimg
holds your bootable image, stored in /tmp/img_tree/boot/.