# kernel-2.6.19 onwards CD/DVD IDE drives are detected as SCSI/SATA like /dev/scd0



## freebird (Apr 7, 2007)

I have installed kernel-2.6.20 in Debian latest via custom apt repo.afterwards udev is creating all these device files and expecting my ide dvd writer and cd writer drives as scsi devices!
here is the udev file:

```
# CD-RW_CRX210E1 (pci-0000:00:0f.1-scsi-0:0:1:0)
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:1:0", SYMLINK+="cd
rom", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:1:0", SYMLINK+="cd
rw", ENV{GENERATED}="1"
# CDDVDW_SH-S182F (pci-0000:00:0f.1-scsi-0:0:0:0)
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:0:0", SYMLINK+="cd
rom1", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:0:0", SYMLINK+="cd
rw1", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:0:0", SYMLINK+="dv
d1", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:0:0", SYMLINK+="dv
drw1", ENV{GENERATED}="1"
```
I dont know how the kernel detects ide drives as scsi things!
here is part of dmesg:


> SCSI subsystem initialized libata version 2.00 loaded.
> ata1: SATA max UDMA/133 cmd 0xDF806D00 ctl 0x0 bmdma 0x0 irq 221
> ata2: SATA max UDMA/133 cmd 0xDF806D80 ctl 0x0 bmdma 0x0 irq 221
> ata3: SATA max UDMA/133 cmd 0xDF806E00 ctl 0x0 bmdma 0x0 irq 221
> ...


and /var/log/messages shows:


> Apr  7 15:11:39 localhost kernel: ahci 0000:00:0f.0: AHCI 0001.0000 32 slots 4 ports 3 Gbps 0xf impl IDE mode
> Apr  7 15:11:39 localhost kernel: ahci 0000:00:0f.0: flags: 64bit ncq pm led clo pmp pio slum part
> Apr  7 15:11:39 localhost kernel: ata1: SATA max UDMA/133 cmd 0xDF806D00 ctl 0x0 bmdma 0x0 irq 221
> Apr  7 15:11:39 localhost kernel: ata2: SATA max UDMA/133 cmd 0xDF806D80 ctl 0x0 bmdma 0x0 irq 221
> ...


I tried removing modules like sr_mod etc but to no avail.Geeks here can u help?

Although it works perfectly in default kernel-2.6.18-4  and the correct device block files are created; /dev/hda for dvd drive and /dev/hdb for cd drive.


----------



## eddie (Apr 8, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

You need to upload your config file as well. Also you need to edit your udev rules so that it reads ide instead of scsi.


----------



## freebird (Apr 8, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

OK.You may be knowing that debian freezes its pkgs for the so called Etch release(i dont care!) and debian does not yet have an official 2.6.20 kernel released,but i have taken from subversion apt repo( *kernel-archive.buildserver.net/debian-kernel ) I use apt-pinned Debian bleeding edge repositories.I feel udev rules needs to be updated for linux-2.6.20-1.even i compiled and installed a 2.6.20-1 kernel,but that too did the same,making lot of device files for cd,dvd drives.
I have attached copies of default 2.6.18-4 and 2.6.20-1(problem!) kernel config files.I already tried editing udev rules and applying it using udevtrigger cmd  but no use even i dont know much about the syntax.

Between I got an ASUS-P5VDC-MX pentium4 mobo using via chipset and contains 4 sata ports and my dvd and cd writers are connected serially to the ide port.


----------



## praka123 (Apr 8, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

I think wait for a udev release alongwith official 2.6.20 kernel.ofcourse u can edit /etc/udev/udev.conf


----------



## eddie (Apr 9, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

Your kernel config files, as expected, look similar to each other but I don't understand your udev rules file. Did you completely delete the CD/DVD rule lines? The ones that you mentioned in the very first post are no where to be seen now. I also asked you to edit those lines so that the scsi in pci-0000:00:0f.1-scsi-0:0:1:0 line reads ide i.e. pci-0000:00:0f.1-ide-0:0:1:0. Try doing that and also update udev from the svn repositories as well. It could very well be that debian changed some things in udev rules which is causing you problems.


----------



## freebird (Apr 9, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

The First post that contains the device names are from  /etc/udev/rules.d/z25_persistent-cd.rules 
But In Debian,this file is created and ruled by config files like  /etc/udev/udev.rules(the one i attached) the line:
# SCSI devices
SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n"
So if i edit the pci-0000:00:0f.1-scsi-0:0:1:0 line to pci-0000:00:0f.1-ide-0:0:1:0 it simply doesnt hold;udev reads from /etc/udev/udev.rules.
in that file is creating these unwanted device files(i think).I have doubt with another file in the /etc/udev directory which is /etc/udev/devfs.rules and is similar in content to the /etc/udev/udev.rules file but with a line added more and inspiring:

```
prakrut:~# less /etc/udev/devfs.rules
#IDE devices
SUBSYSTEMS=="ide", KERNEL=="hd[a-z]*", PROGRAM="ide-devfs.sh %k %b %n", \
                                        ACTION=="add", \
                                        NAME="%c{1}", SYMLINK+="%k %c{2}"
```
 but isnt devfs deprecated in linux-2.6?
Should I copy this lines into the /etc/udev/udev.rules?
also in the /lib/udev/ all files are maintained by depending on the main files in /etc/udev.

BTW i forgot to tell that i have a sata 80gb hdd ( ST380013AS) which is connected to sata port.
my /proc information on my "scsi" cd/dvd drives:

```
prakrut:~# cat /proc/scsi/scsi 
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST380013AS       Rev: 3.18
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
  Vendor: TSSTcorp Model: CD/DVDW SH-S182F Rev: SB02
  Type:   CD-ROM                           ANSI SCSI revision: 05
Host: scsi4 Channel: 00 Id: 01 Lun: 00
  Vendor: SONY     Model: CD-RW  CRX210E1  Rev: 2YS2
  Type:   CD-ROM                           ANSI SCSI revision: 05
```


```
ls -lR /dev/disk
/dev/disk:
total 0
drwxr-xr-x 2 root root 560 2007-04-09 10:11 by-id
drwxr-xr-x 2 root root 340 2007-04-09 10:11 by-path
drwxr-xr-x 2 root root 260 2007-04-09 10:11 by-uuid

/dev/disk/by-id:
total 0
lrwxrwxrwx 1 root root  9 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4 -> ../../sda
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part1 -> ../../sda1
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part10 -> ../../sda10
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part11 -> ../../sda11
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part12 -> ../../sda12
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part13 -> ../../sda13
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part14 -> ../../sda14
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part7 -> ../../sda7
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part8 -> ../../sda8
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 ata-ST380013AS-5JVF2CN4-part9 -> ../../sda9
lrwxrwxrwx 1 root root  9 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4 -> ../../sda
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part1 -> ../../sda1
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part10 -> ../../sda10
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part11 -> ../../sda11
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part12 -> ../../sda12
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part13 -> ../../sda13
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part14 -> ../../sda14
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part7 -> ../../sda7
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part8 -> ../../sda8
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 scsi-SATA_ST380013AS_5JVF2CN4-part9 -> ../../sda9

/dev/disk/by-path:
total 0
lrwxrwxrwx 1 root root  9 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part10 -> ../../sda10
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part11 -> ../../sda11
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part12 -> ../../sda12
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part13 -> ../../sda13
lrwxrwxrwx 1 root root 11 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part14 -> ../../sda14
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part7 -> ../../sda7
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part8 -> ../../sda8
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.0-scsi-0:0:0:0-part9 -> ../../sda9
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.1-scsi-0:0:0:0 -> ../../scd0
lrwxrwxrwx 1 root root 10 2007-04-09 10:11 pci-0000:00:0f.1-scsi-0:0:1:0 -> ../../scd1
```
Also can i successfully write/burn dvds/cds using these  device files added in /etc/fstab?(replacing /dev/hda and /dev/hdb)
Thanks for All your Help


----------



## eddie (Apr 9, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

Looks like Debian has completely removed devfs support from their latest kernel. devfs is deprecated in 2.6 series but it was not remove completely thus some distros were still carrying it. It could be that Debian was one of those distros but they planned on removing it altogether from their latest offering. You should try updating udev from your svn repositories, check that you do not have devfsd installed and add that ide line you mentioned into your udev.rules.


----------



## praka123 (Apr 10, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

wait for udev-108 it will solve your problems.etch release was just over.so  i believe new kernels and udev upgrades are on the way.otherwise u can download latest udev from *kernel.org and install it,but before u need to remove ur debian udev using dpkg --ignore-depends=udev --purge udev.udev source may contain distro specific in this case debian rules.


----------



## freebird (Apr 10, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

@praka123:how do u do that?pls explain how to upgrade udev-108


----------



## praka123 (Apr 11, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

@freebird:I am not much into udev.but i've posted this in howtoforge.com and the reply I got is from linux-2.6.19-x onwards the ide drives are treated as scsi/sata drives.this is because all ata drivers are controlled by libata,which will name device files as /dev/s** from linux=2.6.19 onwards.It means reduced functonality! .see the quote from lq


> Yes, the reason that your ATA drive shows up as SCSI is because, technichally, it is a SCSI device now. Starting with linux kernel version 2.6.19 all ATA drivers are under libata, which appear as /dev/sdX. Now, for backwards compatibility, you can still use the old ATA drivers, but the Ubuntu devs decided(somewhat smart, somewhat stupid, but needs to be done eventually) that for feisty it would use the new drivers.
> 
> I have some features of my SATA drives that work with hdparm, but some that don't. Try it out, because it might *just work*


 *www.linuxquestions.org/questions/showthread.php?p=2687180#post2687180
Also see who is responsible for:
*lwn.net/Articles/198344/
and:
*lwn.net/Articles/198168/

but there may be work arounds to make the drives appear as ide devices.a custom kernel compile including deprecated PATA drivers is an option(which i didnt try yet)
hopefully debian devels will find an answer with udev latest.


----------



## freebird (Apr 11, 2007)

*Re: cd,dvd drive device files are /dev/scd0,/dev/sg0,/dev/sr0! expert help reqd  *

So this is the reason ,I think as u said i should compile a kernel with the old pata drivers as u said praka123.

Thanks to You Both eddie and praka123,you all are rock geniuses here!

@mod:will u change the title to :
*On kernel-2.6.19 onwards CD/DVD IDE drives are detected as SCSI/SATA like /dev/scd0 instead of /dev/hda 
*as it is more useful Thank You


----------



## praka123 (Apr 12, 2007)

*but this affects the performance of drives like enabling dma..*

With the merge of old pata drivers to libata,there seems to be problems with enabling dma etc.



> By "Parallel ATA" we mean all the ATA/IDE controllers and drives that we have been using for years before SATA. Almost from the start, one of the objectives of some kernel hackers was to replace the IDE drivers available in drivers/ide (everything under the "Device drivers -> ATA/ATAPI/MFM/RLL support" configuration menu) with a reimplementation on top of libata (i.e.: the "SATA layer"). Drivers/ide suffers from many ugly and obscure problems, and re-implementing it on top of libata has been much easier than fixing the unfixable drivers/ide mess - most of the porting work has been done by Alan Cox (a consequence of this PATA merge is that libata and all its SATA drivers have also been moved from drivers/scsi (available in the "Device drivers -> SCSI device support -> SCSI low-level drivers" submenu) to drivers/ata (now "Device drivers -> Serial ATA (prod) and Parallel ATA (experimental) drivers"), and all the CONFIG_SCSI_FOOBAR options for the individual SATA drivers have been changed to CONFIG_FOOBAR, so this means you may need to reconfigure your SATA configuration options)
> This means 2.6.19 may have two drivers for your PATA-based device: The old IDE driver under "Device drivers -> ATA/ATAPI/MFM/RLL support" and an alternative driver under "Device drivers -> Serial ATA (prod) and Parallel ATA (experimental) drivers" (along with the rest of the SATA drivers)
> What one must you choose? Well, the safe option is using the old driver: The old drivers will continue working just as they did before. There'll be no changes if you continue using the old drivers.
> What do the new libata-based PATA drivers offer to you?
> ...


*kernelnewbies.org/Linux_2_6_19#head-cdcbaa9c1b476decdc064e0a75d23d1328b1ddce


----------



## freebird (Apr 13, 2007)

Thank You @praka123,u r good at Linux

I recompiled another kernel with the old drivers for ata drives and also new drivers for sata  hdd drive as u pointed out.
Now my cd and dvd drives are shown as /dev/hda and /dev/hdb and i can enable dma on them which with scsi merge of 2.6.20 kernel we cannot.
Thanks and You rocks!


----------



## praka123 (Apr 13, 2007)

you got it working congrats!!!


----------

