Restoring a Degraded RAID 5 Array with MegaCLI

1. Physical Drive Inventory

To recover a RAID 5 configuration after a disk failure or hardware relocation, execute the following command to list the status of all physical drives attached to Adapter 0. Ensure that application I/O is halted during this process to prevent data corruption.

MegaCli -PDList -a0

2. Identifying the Failed Drive

Scan the output for a drive with the Firmware state set to 'Unconfigured(bad)'. This identifies the drive requiring maintenance. The example below illustrates a SATA drive at Enclosure 32, Slot 4.

Enclosure Device ID: 32
Slot Number: 4
Device Id: 12
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 4.546 TB [0x23d1c2eb0 Sectors]
Non Coerced Size: 4.545 TB [0x23d0c2eb0 Sectors]
Coerced Size: 4.545 TB [0x23d0c0000 Sectors]
Firmware state: Unconfigured(bad)
SAS Address(0): 0x5000cca1225d8a1
Connected Port Number: 0(path0) 
Inquiry Data:     ST4000DM000-XXXX
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device

3. Preparing the Replacement Drive

Transition the drive state from 'bad' to 'good' using the -PDMakeGood flag with the corresponding Enclosure Device ID and Slot Number.

MegaCli -PDMakeGood -PhysDrv[32:4] -a0

Re-check the drive status to confirm it now reports 'Unconfigured(good), Spun Up'.

4. Locating the Missing Array Slot

Identify the specific logical position (Array and Row) of the drive that failed and was removed from the virtual configuration.

MegaCli -PDGetMissing -a0

The output will indicate the missing drive location, such as:

Adapter 0 - Missing Physical drives

No.   Array   Row   Size Expected
0     1       0     4000787 MB

5. Assigning the Physical Drive

Map the newly prepared physical drive to the empty slot in the RAID configuration using the -PdReplaceMissing command.

MegaCli -PdReplaceMissing -PhysDrv[32:4] -Array1 -Row0 -a0

Upon success, the system acknowledges the replacement.

6. Initiating the Rebuild

With the new drive assigned, start the rebuild process to reconstruct the data using the RAID 5 parity information.

MegaCli -PDRbld -Start -PhysDrv[32:4] -a0

7. Monitoring Progress

The reconstruction process generates high I/O load and may take several hours depending on disk capacity. Monitor the progress percentage periodically.

MegaCli -PDRbld -ShowProg -PhysDrv[32:4] -a0

Example output indicating progress:

Rebuild Progress on Device at Enclosure 32, Slot 4 Completed 5% in 12 Minutes.

Tags: RAID MegaCLI System Administration Data Recovery

Posted on Tue, 12 May 2026 23:45:37 +0000 by mordeith