I wrote a script that runs everyday and reports on system emerging problems (such as high file system capacity). In particular, I check SATA disk health with smartctl, using the approach documented by BackBlaze: if any of 5 SMART attributes have non-zero values which historically correlate to future failures, then tell me to replace that disk. For nvme drives, these SMART attributes don't apply, so I use the nvme CLI to check temps, wear, overall health, ... The current version of this script runs on one system and I manually provide the SATA or NVME device names to separate functions. I'd like to run this on multiple systems and automate the discovery of disks and call the appropriate tool (smartctl or nvme). I'd also like to skip USB attached storage - which often does not work with smartctl. Here's camcontrol devlist output.
The first 2 are SATA HDDs attached to SATA ports on the MB. The 3rd is a SATA attached optical drive. 4th is USB flash and 5th is USB HDD. The text in the angle bracts seems to come from the device. For example, when I use a Toshiba flash drive, the text says Toshiba 8GB - no hint that this is USB or flash. My question is - how do I determine which are USB attached from a script? I can't figure out how to correlate the device names from camcontrol to output from usbconfig or lsusb.
Paul
Code:
# camcontrol devlist
<WDC WD10JFCX-68N6GN0 82.00A82> at scbus0 target 0 lun 0 (pass0,ada0)
<WDC WD10JFCX-68N6GN0 82.00A82> at scbus2 target 0 lun 0 (pass1,ada1)
<HL-DT-ST BD-RE WH16NS40 1.02> at scbus3 target 0 lun 0 (cd0,pass2)
< USB Flash Memory 5.00> at scbus4 target 0 lun 0 (da0,pass3)
<Seagate Expansion 9300> at scbus5 target 0 lun 0 (da1,pass4)
The first 2 are SATA HDDs attached to SATA ports on the MB. The 3rd is a SATA attached optical drive. 4th is USB flash and 5th is USB HDD. The text in the angle bracts seems to come from the device. For example, when I use a Toshiba flash drive, the text says Toshiba 8GB - no hint that this is USB or flash. My question is - how do I determine which are USB attached from a script? I can't figure out how to correlate the device names from camcontrol to output from usbconfig or lsusb.
Paul