Replacing Faulty Megaraid Disk

Replacing a drive

Get the enclosure and drive ID using pdlist:

MegaCli -pdlist -aall | more


Ensure you have the right IDs (this is important)

MegaCli -pdinfo -PhysDrv [E:S] -aN


Where [E:S] -aN


E = Enclosure no

S = Slot no

N =  Adapter no ( by default 0 )


Set the drive offline, if it is not already offline due to an error

MegaCli -PDOffline -PhysDrv [E:S] -aN

Mark the drive as missing:

MegaCli -PDMarkMissing -PhysDrv [E:S] -aN

Prepare drive for removal:

MegaCli -PDPrpRmv -PhysDrv [E:S] -aN

Change/replace the drive. It usually starts rebuilding at this point. You will see the activity lights flashing Try this command to check:

MegaCli -PDRbld -ShowProg -PhysDrv [E:S] -aN

If you’re using hot spares then the replaced drive should become your new hot spare drive:

MegaCli -PDHSP -Set -PhysDrv [E:S] -aN

In case you’re not working with hot spares (we don’t), and it does not automatically rebuild, you must re-add the new drive to your RAID virtual drive and start the rebuilding:

MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
MegaCli -PDRbld -ShowProg -PhysDrv [E:S] -aN