Skip to content

Instantly share code, notes, and snippets.

@gousiosg
Last active February 4, 2020 10:09
Show Gist options
  • Save gousiosg/ad676accf8e52e851c5a73a2b43ae0a2 to your computer and use it in GitHub Desktop.
Save gousiosg/ad676accf8e52e851c5a73a2b43ae0a2 to your computer and use it in GitHub Desktop.
Rebuild RAID array when one disk has been marked as faulty (but it is not really)

First you need to have LSI's megacli installed. See how here:

# Get info on RAID arrays
sudo megacli -ldinfo -lALL -a0

If you cannot find an array where state is not (Partially) Degraded don't do any of the steps below!

# Find drive that needs to be replaced or rebuilt
sudo megacli -pdlist -a0 |egrep "Enclosure Device|Slot|Firmware state"

# The drive coordinates look like [enclosure:drv_id]

# Make the state to Unconfigured(BAD)
sudo megacli -pdmarkmissing -physdrv[0:6] -a0

# Make device state good
sudo megacli -pdmakegood -physdrv[0:6] -a0

# Verify that the array started rebuilding
sudo megacli -pdlist -a0 |egrep "Enclosure Device|Slot|Firmware state" | grep
Rebuild

# You could also use megasasctl
# sudo megasasctl

Links with useful info:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment