Get hard drive serial number on RAID with storcli / megaraid

Error message received: ```

Ctl Model Ports PDs DGs DNOpt VDs VNOpt BBU sPR DS EHS ASOs Hlth

0 LSIMegaRAIDSAS9260-8i 8 20 3 1 3 1 Msng On 1&2 Y 2 NdAtn

… … … Controller 0 :


EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type

24:7 23 Failed 1 10.913 TB SATA HDD N N 512B ST12000NM0007-2A1101 U -


From those messages, we know this is Controller 0 or `c0`, enclosure 24 or `e24`, and slot 7 or `s7`. To get the serial number:
`sudo /opt/megaraid/storcli /c0/e24/s7 show all | egrep 'Device attributes|SN = '`

or generically
`sudo /opt/megaraid/storcli /c${controller_id}/e${enclosure_id}/s${slot_id} show all | egrep 'Device attributes|SN = '`

This article was updated on 2023-01-25

I'm nabeards. I'm a full stack JavaScript developer. I travel full time, a.k.a., Professional Wanderer, a.k.a., Digital Nomad.