List error count:
megacli -PDList -aAll | egrep "Enclosure Device ID:|Slot Number:|Inquiry Data:|Error Count:|state"
Check disk's serial number,you need smartmontools:
aptitude install smartmontools
Find Device Id (different from Enclosure Device ID !!!):
megacli -PDList -aAll | egrep "Enclosure Device ID:|Slot Number:|Inquiry Data:|Error Count:|state|Device Id:"
Then in find Device Id serial:
smartctl -a -d megaraid,2 /dev/sda
“2” is Device Id, /dev/sda is logical disk.
megacli -pdoffline -physdrv[252:0] -a0
megacli -pdmarkmissing -physdrv[252:0] -a0
megacli -PDRbld -ShowProg -PhysDrv[252:0] -a0
If you need to remove the hotspares use this:
megacli -PDHSP -Rmv -PhysDrv[252:4] -a0
Adapter: 0: Remove Physical Drive at EnclId-252 SlotId-4 as Hot Spare Success.
-PhysDrv[252:4] is obtained via PDlist command. Now this should show “unconfigured”:
... Firmware state: Unconfigured(good), Spun Up ...
Prepare them for remove:
megacli -PDPrpRmv -PhysDrv [252:5] -a0
Now they should show “spun down” state:
Firmware state: Unconfigured(good), Spun down