Linux – How to recreate a RAID 10 array with mdadm

azurehard drivelinuxraidraid10

So our virtual machine has broken (it's actually a Linux machine in Azure) on which we were running a RAID10 array of 4 disks. It's an ubuntu box. From what I can tell the four data disks are fine, it's just the VM that is screwed.

Now, I could detach the disks from this machine and create a new linux instance, and then attach the disks to that new instance. Question is, how do I get mdadm to setup a RAID10 array using the data on those disks (I don't want it erased as a new drive).

Also, does it matter in what order I attach the disks or will mdadm figure out which disk is which in the array?

Best Answer

I would start by seeing what mdadm thinks is going on.

http://linux.die.net/man/8/mdadm -D, --detail Print details of one or more md devices.

should print a lot of information as I recall telling about the state of each raid device.

I believe $sudo mdadm --query --detail should do the trick there.

Danger Zone Below Here

Note: Any action below may have significant consequences. If the other disks have different checksums, then entire raid will have to undergo a rebuild which may take hours and have performance impacts. The best case is there is that there has been no writes since the event and re-adding will take a few seconds. The worst case is the raid will have to reconverge.

If it says the array is degraded, then you can $ sudo mdadm --manage --add /dev/sd??

If it says the raid is offline, then you need to call a data recovery expert.