Friday, August 31, 2001

Installing internal ATAPI/IDE devices in Linux


First, this is not intended to be a complete HowTo on the subject. You can think of this documents as CliffsNotes on getting a 100MB Internal Zip Drive, an HP Colorado 20 (Travan), and a Mitsumi CR-2801TE CD Burner working with SuSE Linux 7.1.

Related Documents


  1. Determine Hardware IDE Locations
  2. Edit /etc/lilo.conf
  3. Use modprobe to detect the ide-scsi devices
  4. See what scsi-ide devices your system discovered
  5. Discover useful device names as listed in /dev
  6. Add useful entries to /etc/fstab

Determine Hardware IDE Locations

I do not fully understand how to determine these values. However, I will demonstrate my logical deduction in hopes that it will help you as well. I opened the box and discovered that I had 2 IDE chains connecting 4 IDE devices. In my case it looked like this:
|----| Hard Drive |---| CD Burner |
----| Zip Drive |---| Tape Drive |
I determined that (whether correct or not) all 4 devices were discovered by the IDE kernel driver and assigned device addresses in /dev. The device names were as follows:
|----| /dev/hda |---| /dev/hdb |
----| /dev/hdc |---| /dev/hdd |
As mentioned this was just a guess that happened to work. If you know of a more concrete way to discover the device names I would be happy to know the trick.

Edit /etc/lilo.conf

We do not want the IDE driver built in to the Linux kernel to detect these devices. These devices will be accessed through the SCSI subsystem rather than the IDE subsytem (as discussed later). To accomplish this we need to send kernel parameters to Linux on boot. Assuming you are using LILO as your boot loader, all you need to do is add the following line to your /etc/lilo.conf boot entry:
append = "hdb=ide-scsi hdc=ide-scsi hdd=ide-scsi"
Of course your line may look different. Essentially we are telling the kernel that hd* will be controled by the ide-scsi kernel module rather than the ide kernel module. Here is what my whole entry looks like:
image  = /boot/vmlinuz_24
label  = linux_2.4
root   = /dev/hda3
initrd = /boot/initrd_24
append = "hdb=ide-scsi hdc=ide-scsi hdd=ide-scsi"
Obviously you will need to reboot for this setting to take affect.

Use modprobe to detect the ide-scsi devices

Now that you have rebooted and your devices are no longer setup as IDE devices, you need to load the scsi-ide kernel module to setup the devices in the SCSI subsytem. This is pretty easy, just run this command (as root):
modprobe ide-scsi
You will probably want to add this to your startup scripts.

See what scsi-ide devices your system discovered

Your system should now be setup with the new "SCSI" (though they are still technically IDE/ATAPI) devices. To see a list of the discovered device run this command (as root):
cat /proc/scsi/scsi
This should list out your devices. My results look like this:
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: IOMEGA   Model: ZIP 100          Rev: 14.A
Type:   Direct-Access                    ANSI SCSI revision: ffffffff
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: HP       Model: COLORADO 20GB    Rev: 4.01
Type:   Sequential-Access                ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 02 Lun: 00
Vendor: MITSUMI  Model: CR-2801TE        Rev: 1.07
Type:   CD-ROM

Discover useful device names as listed in /dev

Here are pertinent naming conventions that I know of:
  • /dev/sg* All SCSI devices are assigned one of these files. I don't know why but you can't use these from applications, you need to use the more specialized device files below.
  • /dev/scd* SCSI CD ROMS
  • /dev/st* & /dev/nst* Tape devices.
  • /dev/sda* I don't know what type of subclass this represents but /dev/sda4 is my zip drive.
Generally devices take the first available device file, i.e. /dev/scd0. For some reason it is different for the zip drive. You can verify the location of your actual device with the scsi_info command. For example, I can verify that my zip drive is represented by /dev/sda4 with the following command:
scsi_info /dev/sda4
Which gave me these results:
Note: I had to have media in the device before it displayed my drive info.

Add useful entries to /etc/fstab

Now you may choose to add some useful entries to your fstab to make mounting easier. My new entries look like this:
/dev/scd0       /cdrom          auto    ro,noauto,user,exec 0 0
/dev/sda4       /zip            auto    noauto,user 0 0
Now just type the following command to access your drives:
mount /zip
mount /cdrom

No comments: