How to properly configure IDE CDR and/or CDROM drives under Linux
This mini how-to is designed to save you time getting an IDE CD-ROM and/or an IDE CD-RW drive installed and properly configured using SCSI emulation under Linux. Installations of Red Hat 7.0 and 8.0 failed to properly configure IDE CD drives correctly. After scouring the Internet and a lot of trial and error, I finally figured this out. It took so much time I thought others would benefit from my experience. By following this guide you should be able to see all installed IDE drives under SCSI emulation (cdrecord -scanbus) and be able to mount all installed IDE CD drives under a mount point name of your choice.
Throughout this mini howto, I used my IBM Netfinity server as an example. It has one SCSI hard drive, an IDE hard drive on the Primary IDE controller, and two CD devices on the Secondary IDE controller. The Master device is a Sony CD-RW and the slave device is a Sanyo CDROM. It runs Red Hat 8.0, and CDRECORD is already installed. Download the current version from:
ftp://ftp.berlios.de/pub/cdrecord/
The following procedure requires you be logged in as root and your system use the GRUB boot loader.
1) First figure out which device(s) are what. From the console use the dmesg command to view boot messages regarding anything with "hd" (for hard drive)
dmesg | grep hd
You should see something like:
{root@RH8 dev]# dmesg | grep hd
Kernel command line: ro root=LABEL=/ hdc=ide-scsi hdd=ide-scsi
ide_setup: hdc=ide-scsi
ide_setup: hdd=ide-scsi
ide0: BM-DMA at 0xe000-0xe007, BIOS settings: hda:pio, hdb:pio
ide1: BM-DMA at 0xe008-0xe00f, BIOS settings: hdc:DMA, hdd:DMA
hdc: SONY CD-RW CRX220E1, ATAPI CD/DVD-ROM drive
hdd: CDU5211, ATAPI CD/DVD-ROM drive
SCSI device sda: 703322112 512-byte hdwr sectors (360101 MB)
[root@RH8 dev]#
Look for hd?. I this example hdc is the CD-RW and hdd is the CD-ROM
The OS assigns the device name(s) according to:
hda PRIMARY MASTER
hdb PRIMARY SLAVE
hdc SECONDARY MASTER
hdd SECONDARY SLAVE
Write down what device(s) are found.
2) Edit /etc/grub.conf: Append the end of the kernel command line by adding all the hd?=ide-scsi device(s) that relate to your system (written down from Step 1).
For example on my Netfinity server there are two IDE CD devices:
hdc=ide-scsi
hdd=ide-scsi
As an example, my updated kernel command line looks like:
kernel /boot/vmlinuz/-2.4.18-14 ro root=LABEL=/ hdc=ide-scsi hdd=ide-scsi
Adding these statements tells the kernel that the hd? devices are going to use SCSI emulation. Without this the OS will run KUDZU during boot and attempt to talk to the IDE CD devices as standard hard drives. The OS will then incorrectly add mount points (such as /mnt/cdrom1 and /mnt/cdrom2) during boot up with symbolic links to hdc and hdd, none of which will work.
3) Edit /etc/modules.conf: Add the following lines:
options ide-cd ignore='hdc hdd' # tell ide-cd module to ignore these drives
alias scd0 sr_mod # load sr_mod upon access of scd0
alias scd1 sr_mod # load sr_mod upon access of scd1
pre-install sg modprobe ide-scsi # load ide-scsi before sg
pre-install sr_mod modprobe ide-scsi # load ide-scsi before sr_mod
pre-install ide-scsi modprobe ide-cd # load ide-cd before ide-scsi
Notes:
a) The "options" line. If you have more than one IDE device that you want SCSI emulation for, they must be listed here separated by a space, NOT listed on separate lines.
b) Add one "alias" line for each IDE device that will have SCSI emulation with the appropriate scd?
For example, my /etc/modules.conf file looks like:
[root@RH8 etc]# less modules.conf
alias parport_lowlevel parport_pc
alias eth0 3c59x
alias scsi_hostadapter dpt_i2o
options ide-cd ignore='hdc hdd' # tell ide-cd module to ignore drives
alias scd0 sr_mod # load sr_mod upon access of scd0
alias scd1 sr_mod # load sr_mod upon access of scd1
pre-install sg modprobe ide-scsi # load ide-scsi before sg
pre-install sr_mod modprobe ide-scsi # load ide-scsi before sr_mod
pre-install ide-scsi modprobe ide-cd # load ide-cd before ide-scsi
4) Create the mount points for the CD drives. You can call these whatever you want. I suggest using a naming convention that makes some sense to you. For example I used CDRW for the CD-RW drive and CDROM for a CD-ROM drive.
Go to /mnt and see what CD mount points (if any) exist. Use the following command:
ll (that's lower case LL, not eleven. ll is the same as ls -al).
You may see something like:
[root@RH8 mnt]# ll
total 7
dr-xr-xr-x 1 root root 714 Sep 10 2002 cdrom
dr-xr-xr-x 1 root root 2048 Dec 15 1998 cdrw
drwxr-xr-x 2 root root 4096 Feb 24 2002 floppy
[root@RH8 mnt]#
If a CD mount point exists that you do not want delete it with the rmdir command:
rmdir directoryname
will delete the directory called directoryname.
Create the CD mount point(s) (directories) to mount the CD drives with the mkdir command:
mkdir directoryname
makes (creates) a directory called directoryname
For example, I created two CD mount points, CDROM and CDRW, and removed CDROM1.
Write down the CD mount points (directory names) you are going to use.
5) The next step is to create the symbolic link(s). Before creating the symbolic links, verify what links may already exist. Go to /dev and look for any symbolic links using:
ll cd*
For example:
Root@RH8 dev]# ll cd*
lrwxrwxrwx 1 root root 4 May 2 00:37 cdrom -> scd1
lrwxrwxrwx 1 root root 4 May 2 00:37 cdrw -> scd0
brw-rw---- 1 root disk 15, 0 Aug 30 2002 cdu31a
brw-rw---- 1 root disk 24, 0 Aug 30 2002 cdu535
[root@RH8 dev]#
Delete the symbolic CD links that do not correctly point to your CD(s). From /dev, use:
rm linkname
For reference you may want to write down the symbolic links before deleting them.
Since I used two IDE CD's, the SCSI emulation addresses them as scd# (Scsi CD drive#). The Master IDE CD (the Sony CDRW) is scd0 and the Slave IDE CDROM is scd1 (drive numbering starts at 0, not 1).
Create symbolic link(s) using the ln command. For example, from /dev typing:
ln -s scd0 cdrw
creates a symbolic link from SCSI CD 0 to the cdrw mount point (the directory under /mnt). Repeat for each IDE CD device to symbolically link the device to the correct mount point.
6) Edit the /etc/fstab.conf file: Add the lines required for your cd drive(s).
For example:
/dev/cdrom mnt/cdrom iso9660 owner,ro,mode=444,noauto 0 0
/dev/cdrw mnt/cdrw iso9660 owner,rw,mode=444,noauto 0 0
7) Reboot your machine. After reboot, issue the following command to verify the system can see your CD drive(s):
cdrecord -scanbus
You may see something like:
[root@RH8 mnt]# cdrecord -scanbus
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
scsibus0:
0,0,0 0) 'ADAPTEC ' 'RAID-5 ' '3A0L' Disk
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) *
scsibus1:
1,0,0 100) 'SONY ' 'CD-RW CRX220E1 ' '6YS1' Removable CD-ROM
1,1,0 101) 'SONY ' 'CD-ROM CDU5211 ' 'YYS7' Removable CD-ROM
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1,7,0 107) *
[root@RH8 mnt]#
Write down the address for each CD drive (ie 1,0,0 for the CD-RW). Later on some CD programs may need to be configured with this information.
8) Mount the CD(s) using the mount command. Make sure you have a data disk in the CD drive(s) before mounting! For example, to mount the IDE CD's on my system:
mount /mnt/cdrom
mount /mnt/cdrw
Repeat for all drive(s).
9) To verify the CD's are indeed mounted, list the contents of the /mnt/cd* directory(s). Use the ll command such as:
ll /mnt/cdrom or ll /mnt/cdrw
As for writing to CD's, unfortunately you cannot mount a CD-RW drive and just write to. In the Windows world using a program such as Roxio's Direct CD make this a no brainer. In the Linux world you must use a program such as cdrecord and burn an entire ISO image to the CD. This is due to the multiuser design of the Linux OS.
As for burning CD's from the console, there are a lot of command line switches to remember, so I found it convenient to use a console front end. After trying a bunch of different ones, I settled on:
Burncenter - http://alx14.free.fr/burncenter/download/
I hope this helps.
Comments? Questions? Please email me: scott@info-techs.com
|