PreviousINDEXNext
Sendmail Saga [V] Loose EndsDHCP and a wireless PCMCIA card

Writing CDs under Linux

NOTE: This entry applies to Linux 2.4. For Linux 2.6, see this journal entry.

I purchased and fitted a new CD-RW drive for my Linux machine, gold. The following set of instructions are a distilled version of advice on how to get a CD-RW device working under linux, using cdrecord, found on the web. The main sources were two Linux Gazette articles, one by Chris Stoddard and the other by Daniel Feenberg.

cdrecord only talks to SCSI disks, so to you need to install the Linux scsi emulator for ide drives. There are two steps for this: in rc.local (or your favourite equivalent) add the command insmod ide-scsi. Then determine the device designation of the CD-RW driver (in my case /dev/hdd) and ensure the following parameters are passed to the kernel at boot time: hdd=ide-scsi. For lilo this can be performed via the append statement in the lilo.conf file. If you are using grub, simply append the parameter to the kernel invocation line.

Reboot the machine and issue the command cdrecord -scanbus. This will return a list of scsi devices; only one is of interest, usually the first:

Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
scsibus0:
        0,0,0     0) 'HL-DT-ST' 'CD-RW GCE-8520B ' '1.00' Removable CD-ROM
        0,1,0     1) *
        0,2,0     2) *
        0,3,0     3) *
        0,4,0     4) *
        0,5,0     5) *
        0,6,0     6) *
        0,7,0     7) *

To record to the device, first make an image of the files to be burnt using the mkisofs command, then burn it using cdrecord. The device passed to cdrecord must be the list of scsi numbers assigned to the CD-RW found by scanbus. In my example this is 0,0,0.

mkisofs -r -o dev.img dev 
cdrecord -v speed=24 dev=0,0,0 -data dev.img

Here, dev is the directory I wish to copy; dev.img is the image file created by mkisofs.

If you want to read CDs using the CD-RW device, try the following:

  1. Create a link which points to the scsi device that the CD-RW has become (probably scd0) by:
    ln -s /dev/scd0 /dev/cdr
  2. Add a line to /etc/fstab which defines how the new /dev/cdr should be handled:
/dev/cdr /mnt/cdr iso9660 noauto,owner,root,ro 0 0

Now this can be mounted in exactly the same way as a CD-R device.

PreviousINDEXNext
Sendmail Saga [V] Loose EndsDHCP and a wireless PCMCIA card