LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How do /dev/cdrom symlinks work (https://www.linuxquestions.org/questions/linux-hardware-18/how-do-dev-cdrom-symlinks-work-662824/)

Gruik 08-14-2008 02:49 PM

How do /dev/cdrom symlinks work
 
Hi,

Just a question about those symlinks created by udev i think :
Is it important to have them ?
Does it mean that my dvd readers/burners will work better if i have them ?

I went back to Linux a few weeks ago and the last week i realized /dev/cdrom was missing. I thought my drives were not recognized by the kernel so i tried to add several PATA and SCSI drivers into my kernel, i found that the "JMicron" driver was used to make my dvd burner recognized (but not my other dvd drive, my everyday cd/dvd drive).
I wonder what's the link between my dvd rw of brand "Nec" and JMicron, but anyway i realized that my both cdrom drives were present by the files /dev/sr0 and /dev/sr1 (i was first looking for /dev/hdc or something).

There's only /dev/cdrom, /dev/dvdrom, /dev/cdrw and /dev/dvdrw pointing to /dev/sr1 (my dvd writer)
Code:

$ ls /dev -l | grep sr
lrwxrwxrwx 1 root root        3 août 14 19:24 cdrom -> sr1
lrwxrwxrwx 1 root root        3 août 14 19:24 cdrw -> sr1
lrwxrwxrwx 1 root root        3 août 14 19:24 dvd -> sr1
lrwxrwxrwx 1 root root        3 août 14 19:24 dvdrw -> sr1
srw-rw-rw- 1 root root        0 août 14 17:24 log
lrwxrwxrwx 1 root root        3 août 14 19:24 scd0 -> sr0
lrwxrwxrwx 1 root root        3 août 14 19:24 scd1 -> sr1
brw-rw---- 1 root cdrom  11,  0 août 14 19:24 sr0
brw-rw---- 1 root cdrom  11,  1 août 14 19:24 sr1

I use /dev/scd0 to mount a cdrom and it works fine, but as i asked in the beginning, i'm hoping there's no difference when a drive is detected and when it's not detected.


2 lines from dmesg
Code:

scsi 4:0:0:0: CD-ROM            TEAC    DV-516E          2.01 PQ: 0 ANSI: 5
scsi 4:0:1:0: CD-ROM            _NEC    DVD_RW ND-3520A  1.04 PQ: 0 ANSI: 5

dmesg about "sr"
Code:

$ dmesg | grep sr
Driver 'sr' needs updating - please use bus_type methods
sr0: scsi3-mmc drive: 270x/48x cd/rw xa/form2 cdda tray
sr 4:0:0:0: Attached scsi CD-ROM sr0
sr 4:0:0:0: Attached scsi generic sg2 type 5
sr1: scsi3-mmc drive: 48x/48x writer cd/rw xa/form2 cdda tray
sr 4:0:1:0: Attached scsi CD-ROM sr1
sr 4:0:1:0: Attached scsi generic sg3 type 5

Notes:
- Kernel 2.6.26
- My cdrom drives are PATA not SATA (but my hard disk drives are SATA)
- Gentoo
- 64bit system

David the H. 08-14-2008 03:26 PM

AIUI, the symlinks are really just a convenience feature; a way to clean up the mess of different systems having different names for the same types of device, or as a way to simply make devices easier to use and remember. You're certainly not required to use them, and as they are just symlinks, bypassing them and going directly to the main dev entry should cause no trouble.

Another nice use of udev's symlinks is the ability to have a single device name always associated with a particular device. Before udev, using removable devices was often a problem. Device XYZ could be /dev/sda one day and /dev/sdb the next. Now you can have udev detect device XYZ and always create a symlink /dev/XYZ, that could be used no matter if the actual device is sda, sdb, sdc, or whatever. A good example of this is the /dev/disk subdirectory, where block devices (like hard disks and usb thumbdrives, but not cd drives) have dedicated symlinks based on things like serial number and drive label.

On the other hand, I don't think there is as yet a universal consensus on just what symlinks should be standard on systems. On this current system I have /dev/hdc linked to /dev/cdrom and /dev/cdrw, and I have /dev/hdd linked to /dev/dvd and /dev/dvdrw. But both drives are dvd writers. I suppose some day I might go in an fix udev to create more logical symlinks, but for now, I usually just use the base devices instead. :)

BTW, a quick google seems to indicate that the jmicron is a sata controller, or perhaps a kind of pata/sata translator. So you may actually have a sata drive using a pata converter there.

Gruik 08-14-2008 05:14 PM

Thanks for your answer


Quote:

Originally Posted by David the H. (Post 3247801)
BTW, a quick google seems to indicate that the jmicron is a sata controller, or perhaps a kind of pata/sata translator. So you may actually have a sata drive using a pata converter there.

Okay then, seems that there's some JMicron controllers on my MSI motherboard (btw, it's an MSI P45 Neo (Intel P45 chipset))


All times are GMT -5. The time now is 04:34 PM.