Configuring your CD-RW with ide-scsi
The purpose of this document is to give you the step by step procedure
for installing and setting up an ATAPI CD rewriter on a Linux computer.
For the rest of this document, all examples will be /dev/hdc (master
of 2nd IDE port). Modify these examples to fit your machine.
Unless the device itself works, no CDRW functions will work. So start
by confirming that the device works. With no CD in the CDRW tray, and no
mount of the CDRW, and the CDRW tray in the closed position, perform the
following command:
eject /dev/hdc
If the CDRW tray opens, the device works. Otherwise it doesn't. Troubleshooting
includes making sure you really used the master/slave jumper setting you
thought you did, and making sure power and IDE cable are correctly connected.
You might try the command with /dev/hda through /dev/hdh
just to make sure the CDRW isn't connected differently from what you thought.
Once you have your CDRW drive ejecting, it's time to configure its SCSI
emulation...
Configuring SCSI Emulation
ATAPI IDE CDRW drives work with SCSI emulation, which must be configured.
You must know the device (i.e. /dev/hdc) in order to make this
configuration. For the purposes of this example, let's say it's /dev/hdc.
Modifications to /etc/modules.conf
Start by backing up your original /etc/modules.conf. Then add
the following line to /etc/modules.conf:
alias scsi_hostadapter ide-scsi
Note that depending on your distribution, the line might be required to
look like this instead:
alias scsi_cd ide-scsi
I've never seen it necessary, but there are those that say the following
is sometimes also a necessary addition to /dev/hdc:
options ide-cd ignore=hdc
Don't include the preceding line unless you can't get your CDRW to work
without it.
Modifications to /etc/lilo.conf
|
WARNING!
Before modifying /etc/lilo.conf, make sure
you have a boot diskette that will boot your system. Test it. If you don't,
make one with the mkbootdisk program!
Accidents happen, and if you mess up /etc/lilo.conf
without a boot disk, you will encounter extreme difficulties getting your
system to boot.
|
Start by backing up your original /etc/lilo.conf. Note that
lilo.conf has several images, each of which can be booted. In each boot
image you wish to recognize the CDRW, check lilo.conf to see if
it has an append= line. It might look something like this:
append=" devfs=mount quiet"
Because each image can have only one append= statement, you must append
hdc=ide-scsi
to the existing statement, like this:
append=" devfs=mount quiet hdc=ide-scsi"
In the preceding, please remember to substitute hda, hdb,
hdd,
etc. for hdc as appropriate for the CDRW's device.
If a boot image does not have an existing append statement, add the
following line to the boot image.
add the following line to /etc/lilo.conf:
append="hdc=ide-scsi"
After you've saved your modifications, run lilo. It should look something
like this:
[root@mydesk /etc]# lilo
Added linux *
Added linux-up
Added failsafe
Added floppy
[root@mydesk /etc]#
|
If there are error messages, DO NOT reboot until you've fixed them.
Once there are no error messages, reboot the system. If it doesn't boot,
boot it with the bootable floppy you made earlier, back up your lilo.conf,
and then copy the original lilo.conf on top of the one you modified. Then
run lilo again. You should once again be able to boot without
the floppy.
Thank you to Ian Hebert for this update:
If you are using a 2.4.x series kernel, you may experience
kernel panic or similar system lock-up when trying to boot
with ide-scsi emulation. This may be due to the use of DMA
or Direct Memory Access by the ide driver when loading it
for your CDRW device. To correct this problem, add the
following line to /etc/rc.local where /dev/hdc is your
CDRW device:
/sbin/hdparm -d0 -c1 /dev/hdc
This command sets the input/output mode of your CDRW to
disable DMA ( -d0 ) and to enable 32 bit data transfers ( -c1 )
|
Recognizing the CDRW
|
NOTE:
On some Linux distributions, /usr/bin/cdrecord is not executable by
all, and so only works for root. To use it as a normal user you must chmod
it to be executable by all, or else executable by group, chgrp it to a
different group, and then place all users required to use it in that group.
I don't know whether the original mode of cdrecord was an oversight,
or whether it was done for security. |
Try the following command:
cdrecord -scanbus
If you're lucky, it will give you a SCSI device number for the CDRW, as
in the following example:
[root@mydesk root]# cdrecord -scanbus
Cdrecord 1.10 (i586-mandrake-linux-gnu)
Copyright (C) 1995-2001 Jörg Schilling
Linux sg driver version: 3.1.20
Using libscg version 'schily-0.5'
scsibus0:
0,0,0 0) 'CyberDrv' 'CW038D CD-R/RW' 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) *
[root@mydesk root]#
|
Typically you won't get lucky right after the install. Your results
might look more like the disappointing results below:
[root@mydesk root]# cdrecord -scanbus
Cdrecord 1.10 (i586-mandrake-linux-gnu)
Copyright (C) 1995-2001 Jörg Schilling
cdrecord: No such file or directory. Cannot open SCSI driver.
cdrecord: For possible targets try 'cdrecord -scanbus'.
Make sure you are root.
[root@mydesk root]#
|
Results like the preceding are typically caused by ide-scsi,
scsi_cd
or similar modules not being loaded or not being loaded correctly. Run
the rmmod command several times until told it's not loaded:
[root@mydesk root]# rmmod ide-scsi
[root@mydesk root]# rmmod ide-scsi
rmmod: module ide-scsi is not loaded
[root@mydesk root]#
|
Now load the ide-scsi module as follows:
[root@mydesk root]# insmod ide-scsi
Using /lib/modules/2.4.8-26mdk/kernel/drivers/scsi/ide-scsi.o.gz
[root@mydesk root]#
|
Then run cdrecord -scanbus again. If it presents you with a
SCSI device number, continue to the next section. Otherwise, review all
the configuration steps and try variations on /etc/modules.conf.
Be sure after changing /etc/lilo.conf you really ran lilo, and
ran it successfully.
Burning a CD from an ISO Image
Once the cdrecord -scanbus command returns a SCSI device number,
you should be able to burn a CD from an ISO image. Find a known good ISO
image file. For this example we'll use Mandrake81-cd1-inst.i586.iso.
You must also know the maximum speed of your CDRW, and the specified speed
for the media you're using. If your CDRW is 16x write, 12x rewrite and
40x read, its maximum speed is 16x if you're using a write-once blank CD,
but it's 12x if you're using a rewriteable CD media. Furthermore, if the
medium is not guaranteed to that maximum, then the real maximum speed is
the guaranteed speed of the medium. For instance, with the 16/12/40 CDRW,
if you're using a 24x write-once blank, the maximum speed is 16x. But if
you're using a 12x write-once blank, the maximum speed is only 12x.
Once you know the SCSI device number, the maximum speed and the filename
of the ISO image, you can burn the CD. Assuming the info in the preceding
paragraph, with the SCSI device number being 0,0,0, and a 16x write-once
blank CD, the following command should burn the CD:
cdrecord dev=0,0,0 speed=16 -v -eject Mandrake81-cd1-inst.i586.iso
If the CD does not burn and eject, you need to troubleshoot, and that troubleshooting
is beyond the scope of this document. You might want to reduce the speed
to 2x and see if that makes things better.
|