Accessing static drive info w/o ATA identify and lockup with camcontrol identify

Ravi Pokala rpokala at mac.com
Fri Dec 4 16:23:15 UTC 2015


>Date: Fri, 4 Dec 2015 02:13:31 -0700
>From: Kevin Bowling <kevin.bowling at kev009.com>
>To: freebsd-scsi at freebsd.org
>Subject: Accessing static drive info w/o ATA identify and lockup with
>	camcontrol identify
>Message-ID:
>	<CAK7dMtDw7-eFL0HDik3X6O=QA0jKsbuH9wSOTjDiiQdmJhmKJg at mail.gmail.com>
>Content-Type: text/plain; charset=UTF-8
>
>...
>
>#2 This all came about because I want to poll device information like disk
>model, serial number, speeds, etc.  Common use cases would be configuration
>management systems and inventory databases.  Issuing an ATA identify seems
>a bit much and could trigger unwanted HW errata like above.  I'm wondering
>if it would be better to cache the data on interface change in sysctls or
>something.  The data is static, read only, but we need to account for disk
>swaps.

At least some of it is already available via `geom disk list':

    [daneel:~] rpokala% geom disk list ada5
    Geom name: ada5
    Providers:
    1. Name: ada5
       Mediasize: 2000398934016 (1.8T)
       Sectorsize: 512
       Stripesize: 4096
       Stripeoffset: 0
       Mode: r1w1e1
       descr: WDC WD20EFRX-68EUZN0
       lunid: 50014ee20b9f7c0f
       ident: WD-WCC4M1VN0P7L
       fwsectors: 63
       fwheads: 16



GEOM keeps this data in a "struct disk", which is populated during drive attach. You can see that the drive model ("descr") and serial number ("ident") are already listed by GEOM. "struct disk" also already has a rotation-rate field; if that's what you mean by "speeds", it should be trivial for me to add that to the GEOM output as well.

If by "speeds", you're talking about the connection's bus speed (i.e. 3/6/12Gbps), then that's probably more complicated.

-Ravi (rpokala@)

>Regards,
>Kevin



More information about the freebsd-scsi mailing list