This is an old revision of the document!


udev

I ran into this one on an Ubuntu 12.10 desktop. I have two DVD drives and one Blu-ray ROM drive. Devices /dev/sr0 and /dev/sr1 were showing up with /dev/dvd and /dev/dvd1 respectively, but the Blu-ray was only registering /dev/sr2.

I wanted to create two new symlinks for /dev/sr0: /dev/dvd2 and /dev/bluray.

First, I looked at my current udev rules for the DVD drives in /etc/udev/rules.d/70-persistent-cd.rules:

# Memorex_16X-DDL-IN (pci-0000:00:0f.1-scsi-0:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:0:0", SYMLINK+="cdrom", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:0:0", SYMLINK+="cdrw", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:0:0", SYMLINK+="dvd", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:0:0", SYMLINK+="dvdrw", ENV{GENERATED}="1"

# ATAPI_DVD-ROM_16X_Maximum (pci-0000:00:0f.1-scsi-0:0:1:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:1:0", SYMLINK+="cdrom1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.1-scsi-0:0:1:0", SYMLINK+="dvd1", ENV{GENERATED}="1"

Once I figured out how to query udev for it's variables it's displaying, it all clicked into place:

# udevadm info -n /dev/sr2 -q all
P: /devices/pci0000:00/0000:00:0f.0/ata3/host2/target2:0:0/2:0:0:0/block/sr2
N: sr2
S: bluray
S: disk/by-id/ata-ATAPI_iHOS104_3775504067_206017500
S: disk/by-path/pci-0000:00:0f.0-scsi-0:0:0:0
S: dvd2
E: DEVLINKS=/dev/bluray /dev/disk/by-id/ata-ATAPI_iHOS104_3775504067_206017500 /dev/disk/by-path/pci-0000:00:0f.0-scsi-0:0:0:0 /dev/dvd2
E: DEVNAME=/dev/sr2
E: DEVPATH=/devices/pci0000:00/0000:00:0f.0/ata3/host2/target2:0:0/2:0:0:0/block/sr2
E: DEVTYPE=disk
E: GENERATED=1
E: ID_ATA=1
E: ID_ATA_SATA=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1
E: ID_BUS=ata
E: ID_CDROM=1
E: ID_CDROM_BD=1
E: ID_CDROM_CD=1
E: ID_CDROM_DVD=1
E: ID_CDROM_MRW=1
E: ID_CDROM_MRW_W=1
E: ID_MODEL=ATAPI_iHOS104
E: ID_MODEL_ENC=ATAPI\x20\x20\x20iHOS104\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_PATH=pci-0000:00:0f.0-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_00_0f_0-scsi-0_0_0_0
E: ID_REVISION=WL0D
E: ID_SERIAL=ATAPI_iHOS104_3775504067_206017500
E: ID_SERIAL_SHORT=3775504067_206017500
E: ID_TYPE=cd
E: MAJOR=11
E: MINOR=2
E: SUBSYSTEM=block
E: TAGS=:udev-acl:
E: UDEV_LOG=3
E: UDISKS_PRESENTATION_NOPOLICY=0
E: USEC_INITIALIZED=1520096

I created a new rule using those variables and put it into the cd-rules file. I chose my own variables to use as identifiers: the model ID and the firmware version.

# Sony Blu-ray
SUBSYSTEM=="block", ENV{ID_MODEL}=="ATAPI_iHOS104", ENV{ID_REVISION}=="WL0D", SYMLINK+="dvd2", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_MODEL}=="ATAPI_iHOS104", ENV{ID_REVISION}=="WL0D", SYMLINK+="bluray", ENV{GENERATED}="1"

After that, refresh udev and it worked:

udevadm trigger

Now I have /dev/dvd2 and /dev/bluray. Yay :)


Navigation