Originally Published: Wednesday, 24 January 2001 Author: Brian Richardson
Published to: enhance_articles_hardware/Hardware Articles Page: 1/1 - [Printable]

IDE CD-RW Installation Under Linux

Installing an IDE CD-R or CD-RW under Linux involves a few tricks. Brian Richardson's recent experience should help you avoid major problems.

   Page 1 of 1  

I feel quite old now. When I started using recordable CD-ROM drives, they were large external SCSI devices. I remember the pain of wasting ten bucks on CD-R media when the disc failed to write properly.

Now IDE recordable CD-ROM drives are under $200, with the media costing pennies a piece instead of dollars. Low cost write-once (CD-R) and re-writable (CD-RW) CD-ROM make a great backup media. They're also handy for downloading ISO files of the latest Linux distributions.

But IDE CD-RW installation under Linux has one pitfall ... the kernel. Since Linux utilities treat all CD-RW drives as SCSI devices, some kernel modification is required to properly utilize IDE CD-RW drives.

The Setup

I recently installed a HP 9030 IDE CD-RW drive in my work machine (Athlon 700, 128 MB, AMD Viper chipset). This new CD drive is replacing the "generic beige" CD-ROM drive. The HP 9030 is a 10X4X32 CD-RW drive (10X when writing CD-R, 4X when writing CD-RW, 32X when reading CD-ROM media). The CD-RW is setup as the secondary master IDE drive, with my 10GB hard drive as primary master.

To simplify this article, I will make the following assumptions:

  1. Linux is already installed on this computer. My computer is using Mandrake 7.2 with the 2.2.17 kernel.
  2. Source for the current kernel exists in the /usr/src/linux directory, which is already configured for the system. Information on compiling the kernel is available on the Web.
  3. The reader knows how to install the IDE CD-ROM hardware, or has access to some installation guide. Most CD-RW drives will come with a rudimentary hardware installation guide (targeted to Windows users).
  4. The CD-RW drive is replacing an existing CD-ROM drive, instead of being added as a second CD drive.
  5. No SCSI adapters are present in the system.
This presents a setup that applies to most users. Your mileage may vary.

Step One: Re-Configure The Kernel

Note: This article does not cover the exact method for re-compiling the kernel ... that information can be found in the HOW-TO and various other documents. This will cover the options required for CD-RW support when the kernel is configured.

The major issue with ATAPI/IDE CD-RW drives is Linux treats them as SCSI devices. This requires a change to the kernel which emulates all ATAPI/IDE CD-ROM devices as SCSI drives. >From the kernel configuration menu (make xconfig, make menuconfig, etc.), the following changes need to be made:

  1. "Block Devices" Menu
    • turn ON "SCSI emulation support"
  2. "SCSI Support" Menu
    • turn ON "SCSI support"
    • turn ON "include SCSI CD-ROM drivers"
    • turn ON "SCSI generic support"

After the new configuration is saved, recompile the kernel and create the proper boot options for the new kernel in the boot loader. Make sure you have a backup of the current "stable" kernel, in case the newly compiled kernel doesn't work out.

Step Two: Make The Symbolic Link

Reboot you machine using the newly compiled kernel. If all goes well, Linux will boot properly from the new kernel. Now it's time to see if SCSI emulation is properly enabled. This information is displayed at startup, but it goes by too fast for the average person to read. The dmesg command displays the system startup messages.

Login as root and type dmesg | more to scroll through the startup messages. If SCSI emulation is working, the following messages will be displayed:

   scsi0 : SCSI host adapter emulation for IDE ATAPI devices
   scsi : 1 host.
     Vendor: HP        Model: CD-Writer+ 9300   Rev: 1.0b
     Type:   CD-ROM                             ANSI SCSI revision: 02
   Detected scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
   

Note the SCSI device that the new CD-RW was mapped to ... on my Mandrake 7.2 installation, this is /dev/scd0. The current CD-ROM link (/dev/cdrom) must be changed to point to the SCSI device instead of an IDE device (remember ... IDE CD-ROM support doesn't exist any more).

Change to the /dev directory. Remap the SCSI-emulated CD-RW to /dev/cdrom using the following command:

ln -sf /dev/scd0 /dev/cdrom

Step Three: Mount The Drive

Now Linux recognizes that /dev/cdrom is the SCSI-emulated CD-RW. But the drive has to be mounted to read data from the drive. As a test, do the following:

  1. Create a directory named /cdtest
  2. Place a data CD in the CD-RW drive
  3. Type mount -t auto /dev/scd0 /cdtest
  4. Look at the contents of /cdtest to make sure the CD-ROM is readable

If the CD-ROM was properly mounted, its contents will show up in the /cdtest directory. Unmount the CD-RW by typing umount /cdtest.

Now edit the file /etc/fstab, which is a list of the mountable media available to the system. Look for the entry that mentions 'cdrom' ... on my configuration, this line appeared as follows:

/dev/hdc /mnt/cdrom iso9660 ro,noauto,user,exec 0 0

Change the device reference (/dev/hdc) to point to the SCSI device (/dev/scd0). Now the line appears as follows:

/dev/scd0 /mnt/cdrom iso9660 ro,noauto,user,exec 0 0

Save the changes to /etc/fstab. Now the CD-RW drive can be mounted using the command mount /dev/scd0 or mount /dev/cdrom.

Step Four: Configure CD Burning Software

Now that Linux can see your spiffy new CD-RW drive, it's time to make sure the CD burning software can see it. The defacto CD burning program for Linux is cdrecord. The cdrecord program will search for CD-R and CD-RW devices using the following command line: cdrecord -scanbus. This will report the information required for cdrecord and other burning software.

Once cdrecord verifies that the drive exists, it's party time. Download updated copies of cdrecord and mkisofs, which are the two essential Linux CD burning programs (I won't go over their use here, but there's lots of documentation). There are also a number of GUI front-ends and audio utilities to make life easier. So pick up a giant pack of shiny CD-R's and go to town.

Links

The Linux Kernel HOWTO
How To Install CD Drives
cdrecord information at freshmeat.net
mkisofs information at freshmeat.net
CD-Rchive (mkisofs/cdrecord GUI)
X-CD-Roast (mkisofs/cdrecord GUI)
Andy McFadden's CD-Recordable FAQ
CD Writing HOWTO
CDROM HOWTO
You r CD Burner & X-CD-Roast (linuxnewbie.org)
CD Writing Tutorial (for linux)


Blah, blah, blah, Brian Richardson. Blah, blah, blah, linux.com. Blah, blah, blah.




   Page 1 of 1