I need to know which SATA drives are which in my machine so that when I get a disk failure in by RAID array, I can be absolutely sure which disk (identified by serial number) to replace. The udev populated /dev/disk/by-id directory exists for this purpose. On a Parallel-ATA machine I have, this works very well. For example, in the following output I can clearly see the disk serial numbers listed after the model numbers of the drives: # tree /dev/disk /dev/disk |-- by-id | |-- ata-Maxtor_4D080H4_D41S8XWE -> ../../hde | |-- ata-Maxtor_4D080H4_D41S8XWE-part1 -> ../../hde1 | |-- ata-Maxtor_4D080H4_D41S8XWE-part2 -> ../../hde2 | |-- ata-Maxtor_4D080H4_D41S8XWE-part3 -> ../../hde3 | |-- ata-Maxtor_4D080H4_D41S8Y5E -> ../../hda | |-- ata-Maxtor_4D080H4_D41S8Y5E-part1 -> ../../hda1 | |-- ata-Maxtor_4D080H4_D41SA6PE -> ../../hdc | |-- ata-Maxtor_4D080H4_D41SA6PE-part1 -> ../../hdc1 | |-- ata-Maxtor_4D080H4_D41SA72E -> ../../hdg | |-- ata-Maxtor_4D080H4_D41SA72E-part1 -> ../../hdg1 | |-- ata-Maxtor_4D080H4_D41SA72E-part2 -> ../../hdg2 | `-- ata-Maxtor_4D080H4_D41SA72E-part3 -> ../../hdg3 |-- by-path | |-- pci-0000:00:05.0-ide-0:0 -> ../../hda | |-- pci-0000:00:05.0-ide-0:0-part1 -> ../../hda1 | |-- pci-0000:00:05.0-ide-1:0 -> ../../hdc | |-- pci-0000:00:05.0-ide-1:0-part1 -> ../../hdc1 | |-- pci-0000:00:11.1-ide-0:0 -> ../../hde | |-- pci-0000:00:11.1-ide-0:0-part1 -> ../../hde1 | |-- pci-0000:00:11.1-ide-0:0-part2 -> ../../hde2 | |-- pci-0000:00:11.1-ide-0:0-part3 -> ../../hde3 | |-- pci-0000:00:11.1-ide-1:0 -> ../../hdg | |-- pci-0000:00:11.1-ide-1:0-part1 -> ../../hdg1 | |-- pci-0000:00:11.1-ide-1:0-part2 -> ../../hdg2 | `-- pci-0000:00:11.1-ide-1:0-part3 -> ../../hdg3 `-- by-uuid |-- 0a5e7442-187d-79ff-8ae9-d2c835170d8a -> ../../hdg3 |-- 2fab9c58-76d5-4072-be5e-fdb588f1123d -> ../../md/3 |-- 67762a1c-25d9-4edd-e389-9f3a98c93887 -> ../../hdg2 |-- 7df05435-33ac-72d0-11bd-3f6e9af157a6 -> ../../hdg1 |-- 8719f3a5-52ee-11e3-5e6c-8ef110ad9971 -> ../../hdc1 |-- 894b3a59-358b-435c-909b-f94bb6733d98 -> ../../md/1 |-- a1203fec-ec7f-4917-8040-47cbf91892ab -> ../../md/2 `-- da478ac2-2e79-45b4-b784-3f1e297c03e3 -> ../../md/0 However, it doesn't work so well on a SATA machine. One of my drives (/dev/sda) is missing altogether from by-id & by-uuid, even though it is present in by-path. In by-id, I can see the drive model number, but there is unhelpful text where I was expecting the drive serial number. Note that some USB attached drives are fine, even though also appear as SCSI drives: # tree /dev/disk /dev/disk |-- by-id | |-- scsi-0ATA_Maxtor_6Y160M0_Linux_ATA-SCSI_simulator -> ../../sdb | |-- scsi-0ATA_Maxtor_6Y160M0_Linux_ATA-SCSI_simulator-part1 -> ../../sdb1 | |-- scsi-0ATA_Maxtor_6Y160M0_Linux_ATA-SCSI_simulator-part2 -> ../../sdb2 | |-- scsi-0ATA_Maxtor_6Y160M0_Linux_ATA-SCSI_simulator-part3 -> ../../sdb3 | |-- usb-Maxtor_OneTouch_Y3LYJVEE -> ../../sdc | |-- usb-Maxtor_OneTouch_Y3LYJVEE-part1 -> ../../sdc1 | |-- usb-Maxtor_OneTouch_Y3LYZ0SE -> ../../sdd | `-- usb-Maxtor_OneTouch_Y3LYZ0SE-part1 -> ../../sdd1 |-- by-path | |-- pci-0000:00:1f.2-scsi-0:0:0:0 -> ../../sda | |-- pci-0000:00:1f.2-scsi-0:0:0:0-part1 -> ../../sda1 | |-- pci-0000:00:1f.2-scsi-0:0:0:0-part2 -> ../../sda2 | |-- pci-0000:00:1f.2-scsi-0:0:0:0-part3 -> ../../sda3 | |-- pci-0000:00:1f.2-scsi-1:0:0:0 -> ../../sdb | |-- pci-0000:00:1f.2-scsi-1:0:0:0-part1 -> ../../sdb1 | |-- pci-0000:00:1f.2-scsi-1:0:0:0-part2 -> ../../sdb2 | |-- pci-0000:00:1f.2-scsi-1:0:0:0-part3 -> ../../sdb3 | |-- usb-Y3LYJVEE:0:0:0 -> ../../sdc | |-- usb-Y3LYJVEE:0:0:0-part1 -> ../../sdc1 | |-- usb-Y3LYZ0SE:0:0:0 -> ../../sdd | `-- usb-Y3LYZ0SE:0:0:0-part1 -> ../../sdd1 `-- by-uuid |-- 2b9ac501-a3c8-4860-a251-d639c78335fc -> ../../md/2 |-- 3589a7d3-46cf-4704-b064-80a95916141c -> ../../sdd1 |-- 5a4f4464-0b58-1068-a788-5c5b3e1f109d -> ../../sdb1 |-- 7293013d-38d3-5da5-73a1-1aa2d8ed4f07 -> ../../sdb2 |-- a5c7e1a4-0c32-4a43-8adb-e3d57ca82984 -> ../../md/0 |-- c05c061d-124c-4011-9ec5-bfb794a31de2 -> ../../sdc1 `-- cf90252c-3fef-9382-56cc-56dc7ce36f8e -> ../../sdb3 I am using sys-fs/udev-070, sys-apps/baselayout-1.11.13-r1, sys-apps/hotplug-20040923-r1 & sys-apps/coldplug-20040920. Earlier udev versions had no by-id or by-label directories at all. I have tried kernels sys-kernel/vanilla-sources-2.6.12.5, sys-kernel/vanilla-sources-2.6.13.2 & gentoo-sources/-2.6.13-r3. No differences. I have RC_DEVICE_TARBALL="no" in /etc/conf.d/rc, but it was no different with "yes". Reproducible: Always Steps to Reproduce: Boot machine. Examine udev tree with 'tree /dev/disk'
Tried sys-fs/udev-071. No change.
Tried sys-kernel/vanilla-sources-2.6.13.4. No change.
Are you sure you merged the udev config file correctly? 070 should have had a fix for this.
Pretty sure. I don't remember changing any of them. I didn't get any CONFIG_PROTECT warnings when I updated to 071, so I guess I'm using a clean set of config files.
As I mentioned before, udev-070 _was_ a lot better than earlier versions, so the fixes did improve things. Before I tried 070 I had no by-id or by-path trees at all!
Tried sys-kernel/vanilla-sources-2.6.14. No change.
I don't really know what to do about this. Your scsi disks are probably just odd ones that the id program can't detect properly. And yes, your usb disks show up as scsi disks, that's the way that they work. Can you run the following: scsi_id -g -x -s /block/sda -a as root, and let me know what the output is?
The drives are regular Maxtor Serial-ATA drives as shipped with many workstations, esp. from Dell. I mentioned the working USB disks to show that the kernel's concept of modelling disks as SCSI disks (as with SATA) is not inherently broken. Presumably the lack of a decent serial number is due to the kernel libata driver, not udev. There is no difference in the scsi_id output that would indicate why sdb appears, but not sda... # scsi_id -g -x -s /block/sda -a ID_VENDOR=ATA ID_MODEL=Maxtor_6Y160M0 ID_REVISION=YAR5 ID_SERIAL=0ATA_Maxtor_6Y160M0_Linux_ATA-SCSI_simulator ID_TYPE=disk ID_BUS=scsi # scsi_id -g -x -s /block/sdb -a ID_VENDOR=ATA ID_MODEL=Maxtor_6Y160M0 ID_REVISION=YAR5 ID_SERIAL=0ATA_Maxtor_6Y160M0_Linux_ATA-SCSI_simulator ID_TYPE=disk ID_BUS=scsi
I really don't know what to suggest. Care to work with upstream at the linux-hotplug-devel mailing list?
Will do. I'll post the results here.