"Linux Gazette...making Linux just a little more fun!"
Easy Addition of an IDE CD-Writer to a Linux/Redhat PC
The CD-Writing HOWTO at http://www.guug.de/~winni/linux/and the official
cdrecord site at
www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html offer
a great deal of information about installing and using CD-ROM writers. Certainly much
more than you need to know for an ordinary Linux installation. If you don't want to support
an obsolete drive, or an older kernel, or VAX VMS, then you probably don't need to recompile
the kernel or make any devices. This short document should be sufficient to get you started
burning disks. Once you are started, the official documents will guide you to such esoterica
as audio, bootable, multisession and hybrid disks.
After determining that RedHat 6.1 was so easy, I tried setting up several other distributions,
including RedHat 6.0, SUSE 6.1, Debian 2.1, and Storm 2000. All of those were slightly harder
because they didn't include a recent version of cdrecord but none required a kernel rebuild, I
have noted the differences along the way. You will need to have:
- a supported IDE drive,
- a Linux kernel that supports loadable device drivers,
- use LILO to boot. (Default for most distributions).
- cdrecord 1.8 or better (included with RedHat 6.1).
I believe any drives you bought in a store recently will qualify. The
cdrecord docs say that all 1999 or later ATAPI drives support MMC, which
is sufficient. Many earlier drives are suppoted also. A look on the
shelves at the local computer superstore did not turn up any that
mentioned MMC or Linux on the box. My first installation used an older
Richoh MP6200A cd recorder. I did more installations with the MagicWriter
4X4X24. This is a very cheap drive, but the manual had a 1999 copyright
date and it did work as I expected.
Physical Installation
Perform the physical installation of the new drive just as you would
any ide drive. It can replace your original read-only drive or be added
on. Make sure the drive jumper is set for master or slave as required, the
power cable is connected and the data cable has the correct orientation.
You shouldn't have to do any CMOS setup. I am told that keeping the
cd-writer on a different cable from the hard drive speeds data transfers,
but this is probably not significant with Pentium class machines.
At this point stop to check if the BIOS mentions the drive during BIOS
initialization. Not all BIOS do that, but especially if it doesn't, you
might want to check the cables and the Master/slave jumpers on both the
CD-writer and any other drive on the same cable. The /var/log/messages
file should have a line about the new "ATAPI" drive.
SCSI Emulation Setup
- Find out the name of physical CD-ROM device. This is probably /dev/hdc
(the master device on the second IDE cable) but could be /dev/hdb (slave
device on the primary IDE cable or /dev/hdd (slave device on the secondary
cable).
- Become root.
- Add the following line to the end of your /etc/rc.local:
insmod ide-scsi
RedHat seemed to be the only distribution with an rc.local file. for
the others, you have to find some other mechanism for running this command
before burning disks and after each reboot.
- Add the following line to your /etc/lilo.conf file:
append="hdc=ide-scsi"
where "hdc" might be "hdb" or "hdd" depending on where your drive is installed. This line
should be inserted just after the image statement that boots Linux on your computer. This
instructs the kernel to access the cd-writer via the scsi emulation driver.
- Reconfigure LILO by running the following command at the Unix
shell prompt:
lilo
- You need to ``install'' cdrecord and mkisofs. Version 1.8.1 of
cdrecord is on the RedHat disk in an rpm file. Here are the commands for
the software installation with RedHat.
cd /cdrom/RedHat/RPMS
rpm --install cdrecord*
rpm --install mkisofs*
The other distributions either included an older version of cdrecord (1.6)
which did not support my recorders, or did not include cdrecord at all. If
don't have RedHat and need to compile these yourself, the most recent
version of cdrecord can easily be found at www.freshmeat.org. I noted that
the very extensive cdrecord instructions cover many operating systems, not
just Linux (or even Unix). For the distributions considered here, all you
need to do is:
tar -xvf cdrecord*tar
cd cdrecord-1.8
make
make install
The cdrecord tarball includes mkisofs. Both packages get installed to
/opt/shilly/bin so you will need to make links from a directory in the
root path, such as /usr/bin. A very nice feature of cdrecord is that it
auto-detects the drive characteristics at run time so there isn't any
configuration and you can replace or upgrade the drive without getting
into trouble.
- If you want to read with the recorder, you will need to add or
modify the appropriate line in /etc/fstab so that the drive is addressed
through the ide-scsi interface. The following worked for me, but the
device name may not be correct for all distributions (/dev/sg0 is an
alternative), and in any case reading is beyond the scope of this
document.
/dev/scd0 /cdrom auto defaults,ro,noauto,user,exec 0 0
- Reboot the machine. The installation is complete. My impression is
that if you did anything wrong, there won't be any error messages, so go
back and check the spelling of the changes listed above before proceeding
to actually testing your work.
- Now you get to check if the installation was successfull:
cdrecord -scanbus
One of the output lines should mention a Removable CD-ROM, and maybe even
indicate ``-R'' or ``RW'' to indicate that it is a recorder. Something
like this:
0,0,0 0) 'Richoh' 'MP602A' '2.03' Removeable CD-ROM Drive
Only the digit triple at the start is significant. It indicates
controller, SCSI ID, and LUN, and is likely to be all zeroes, as shown
with SCSI emulation. The only error message I saw in my experiments
combined the cases of (1) scsi emulation not correctly installed and (2)
drive not found or supported. At that point you might try getting reading
to work as an IDE drive in Windows, then in Linux as IDE, then in Linux
with SCSI emulation, before concluding that the drive was not supported or
broken. I often find this systematic approach to hardware debugging slow
but sure.
Writing Disks
- Writing disks is a two step process. First the ISO filesystem is
created on your hard disk:
mkisofs -v -o file.iso file...
where file.iso is your output file and file... is the list
of files and directories you want on the cd-rom. If you just list a single
directory, the structure is maintained on the CD. Otherwise all the files
and subdirectory files are dropped into the root directory with no
subdirectory structure. There are a lot of options described in the man
page. If you keep your filenames to 8.3 lower case, you won't need to be
bothered with most of them. The "-J" option (for Joliet) will allow longer
Windows style filenames, but if you actually use longer or case sensitive
names your file names will look funny or not work in a minimal ISO9660
system.
- Then you actually burn the cd-rom:
cdrecord -v dev=0,0,0 file.iso
The ``dev=0,0,0'' specifies the output device, and might be possibly be
different on your system, check the cdrecord -scanbus output if in doubt.
Because cdrecord wants to lock pages in memory, it has to be run as root.
Making cdrecord setuserid root is endorsed by the Shilly's documentation.
On my 1997 vintage 233mHz AMD with a 5400 rpm hard disk, and a quad
speed CD-ROM writer, the system had no trouble maintaining speed and the
512K buffer was never less than 97% full. After initial success you might
try combining the mkisofs and cdrecord steps:
mkisofs file... | cdrecord -v dev=0,0,0 -
where the hyphen indicates to cdrecord that it should take its input from
the standard input. This worked on my system, even when the files were NFS
mounted (on a 100BaseTX connection).
Any corrections or suggestions should be sent to me. I am particularly
interested in hearing which distributions will work with these minimal
instructions and any variations. I don't want to encroach on existing
documentation by covering enhanced capabilities - that is well handled
already by the existing documentation.
This page is kept at http://www.nber.org/cdrecord.html
[There is another article about CD
recording in this issue. -Mike.]
Copyright © 2000, Daniel Feenberg
Published in Issue 57 of Linux Gazette, September 2000