Is the HDD description field available to a script?

I would like to get the description (see pic from Storage / Disks with ‘description’ column showing) from each HDD via a script? Is that possible?

While I am here - can you make my column selections permanent?

midclt call disk.query will return all disks as json, including the description field

below will search for vdb

root@fangtooth[~]# midclt call disk.query '[["name","=","vdb"]]' | jq
[
  {
    "identifier": "{uuid}85f2567e-721c-43a1-8c07-f3ef578540b4",
    "name": "vdb",
    "subsystem": "virtio",
    "number": 65040,
    "serial": "",
    "lunid": null,
    "size": 1099511644160,
    "description": "big virtual disk",
    "transfermode": "Auto",
    "hddstandby": "ALWAYS ON",
    "advpowermgmt": "DISABLED",
    "togglesmart": true,
    "smartoptions": "",
    "expiretime": null,
    "critical": null,
    "difference": null,
    "informational": null,
    "model": null,
    "rotationrate": null,
    "type": "HDD",
    "zfs_guid": "15335025076019942347",
    "bus": "UNKNOWN",
    "devname": "vdb",
    "enclosure": null,
    "supports_smart": null,
    "pool": null
  }
]

this will return the results for the list, ["vda","vdb"]

midclt call disk.query '[["name","in",["vda","vdb"]]]'

by changing “name” to another field, you can search on any other characteristic.

eg:

root@fangtooth[~]# midclt call disk.query '[["zfs_guid","=","15335025076019942347"]]' | jq
[
  {
    "identifier": "{uuid}85f2567e-721c-43a1-8c07-f3ef578540b4",
    "name": "vdb",
...
1 Like