0

Though I've got quite a good basic understanding of sysfs meanwhile, there are still things I cannot solve on my own.

For a starter, I'd like to figure out via sysfs (later by scripting of course) which channel a block device (HDD, DVD...) is connected to.

The funny thing about it is that it is possible for me how to figure out master or slave! There is an internal ID deeply rooted in the sysfs tree which gives this away: so 9:0:1 will mean that the device is connected to a (primary OR secondary) slave channel. (master when last digit 0; slave when last digit is 1) OK, but this will still not tell me whether it's the primary or secondary channel.

While doing some research about this, I found a Linux 2.6-related post in LKML: https://lkml.org/lkml/2006/3/25/20 revealing a sample path like ../../../devices/pci0000:00/0000:00:04.0/ide0/0.0/.

Well this is EXACTLY what I need!
Unfortunately though, the ideX is nowhere to find in sysfs as of Linux 3.x. Maybe it was removed for good in kernel version 3?

0

Things have been reorganised.

Now, ATA devices (old IDE PATA — parallel — and newer SATA — serial) are all under the /sys/devices/pcixxxx:xx/xxxx:xx:xx.x/atax path (where x represents numbers), for instance /sys/devices/pci0000:00/0000:00:11.0/ata1/link1 for the first device on the first controller.

  • OK, thanks, but what if it is a PATA controller, with all but the primary slave channel connected to a device? Won't link just be numbered link1, link2, link3 anyway? I would not think that there will be a gap (as ..1, ..3, ..4). – syntaxerror Feb 12 '15 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.