inside the mind of a linux admin

RAID: Rebuilding a Foreign disk by hand

While replacing a bad drive with a drive that used to be part of another RAID array configuration, the RAID refused to automatically rebuild, thinking that I might want to import the configuration from this disk (or that there’s data on there that I might need).

Simply inserting the drive doesn’t make the controller rebuild the array with that disk. Here’s how to manually make the drive get along with the rest of the new array:

(Note: this is a 64 bit server, so the MegaCli client I’m using is called “MegaCli64”, if you are not running x64, you can simply substitute the commands below with the path to your megacli binary.)

server:~# MegaCli64 -PDlist -aALL -a0
[…]
Enclosure Device ID: 32
Slot Number: 4
[…]
Firmware state: Unconfigured(bad)
[…]
Secured: Unsecured
Locked: Unlocked
Foreign State: Foreign
[…]

Based on the information obtained above, I now know that the disk drive I just replaced is [32:4] ([enclosureid:slotnumber]) and is currently being reported as ‘Unconfigured(bad)’.

To bring this drive back online run:

server:~# MegaCli64 -PDMakeGood -PhysDrv[32:4] -a0
Adapter: 0: EnclId-32 SlotId-4 state changed to Unconfigured-Good.

The controller will now recognize the disk as being a “foreign” one. This does not mean it was made in Japan (though, it likely was). It means it has detected some RAID configuration/data on it and thus, considers it as a disk being part of an array that may be imported into current controller configuration. Because of this, it will not automatically rebuild until you force it to.

Now you can ask the controller to scan for foreign configurations and remove them:

server:~# MegaCli64 -CfgForeign -Scan -a0
There are 1 foreign configuration(s) on controller 0.

server:~# MegaCli64 -CfgForeign -Clear -a0
Foreign configuration 0 is cleared on controller 0.

The disk should now be available for rebuilding into your new RAID array. To confirm, run this:

server:~# MegaCli64 -PDList -a0
[…]
Enclosure Device ID: 32
Slot Number: 4
[…]
Firmware state: Unconfigured(good), Spun Up
Foreign State: None
[…]

Excellent. We have a good, recognized (yet still unconfigured) drive now. Now we have all we need to add the disk back into the new array, and rebuild:

Get the disk [32:4] back into array 1, as disk 4:

server:~# MegaCli64 -PdReplaceMissing -PhysDrv[32:4] -array1 -row4 -a0
Adapter: 0: Missing PD at Array 1, Row 4 is replaced

And finally start rebuilding it:

server:~# megacli -PDRbld -Start -PhysDrv[32:4] -a0
Started rebuild progress on device(Encl-32 Slot-4)

Now, sit back, relax, grab a smoke and wait for it to rebuild itself into your new RAID array. Not so foreign anymore, huh?

-E

Related Posts

synergy: How to enable crypto (encryption) and generate SSL certificate

The newer Linux versions of the popular mouse/keyboard sharing application “synergy” now has built in encryption. Here’s how to configure it: Just simply passing the –enable-crypto flag on your synergy server without having a proper SSL certificate will result in the inability to connect to clients and generate an error message similar to this in […]

Read More

Change Number Pad Delete (dot) key from a comma in Ubuntu Linux

I recently purchased a new keyboard and updated to the latest Ubuntu, I’m also an avid user of the number pad for quick input when dealing with spreadsheets or accounting. I found that my num pad’s delete key (“.”) was outputting a comma (“,”) instead. Pretty annoying? I agree, but this can be very easily […]

Read More

7 Comments

  • Time Master on Wednesday, July 20, 2011

    Thank you, that was helpful.

  • Sean on Wednesday, October 10, 2012

    Thanks for the excellent description!

  • name withheld on Thursday, July 28, 2016

    -array1 how did you get that?

  • Erik on Friday, July 29, 2016

    it’s the first array

  • Erik on Friday, July 29, 2016

    very welcome, happy it helped!

  • Erik on Friday, July 29, 2016

    sure thing!

  • Rob on Friday, April 20, 2018

    Very helpfull

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.