I am trying to create a script that will be run against servers that will vary in configuration, and which will be unknown going in.
What I can rely on expecting at least are which controllers to expect, just not the exact hard drive configuration attached to the controller.
The controller type that is giving me difficulty is megaraid.

smartctl --scan is able to find the virtual device, /dev/sda for example but is there any functionality to determine the number of drives that make up the virtual device, in order to output SMART data for each of those drives.


Some of the megaraid complications are already documented in smartctl, such as in some cases device enumeration starting at (8) rather than (0). Is there any way to detect the device enumeration along with the number of drives. The last bit that would need to be detected is whether the attached drive is SATA so sat+ can be run.