chiark / gitweb /
Run ata_id on non-removable USB devices
authorDavid Zeuthen <davidz@redhat.com>
Wed, 30 Mar 2011 12:11:03 +0000 (08:11 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Wed, 30 Mar 2011 14:28:24 +0000 (10:28 -0400)
commit42b9482ab2da64b4c2f254c227c0efaf83988a84
tree621d833e991ad7eeaae929a2f5b37dd7e75dafed
parenta138cd07145519f30226e06d41b0a11b50864658
Run ata_id on non-removable USB devices

If a USB device is marked as removable, it is often a SATA/PATA disk
in an enclosure (note that flash card readers and usb storage sticks
are always marked as removable). In this case, try running ata_id
(which sends ATA commands wrapped in SCSI ATA PASS THROUGH commands)
to get information about the disk. If this fails, just fall back to
running usb_id since it could be the device isn't an ATA device at
all or the device doesn't have a SAT layer.

This extra information is nice to have as it indicates if it is
suitable to send e.g. SMART commands to the disk, whether the disk
supports power management and so on. Additionally, the VPD and serial
number returned by ata_id is usually more accurate as it stems from
the disk itself instead of the enclosure.

Note that udisks has been doing this for a while

 KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="usb", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"

so this change shouldn't be too disruptive (udisks-probe-ata-smart
also sends ATA commands via the ATA PASS THROUGH command).

Signed-off-by: David Zeuthen <davidz@redhat.com>
rules/rules.d/60-persistent-storage.rules