Crashing and recovering a RAID1

In a previous post, I explained in details how to create RAID1 system with a LVM filesystem. Now what if we crash it?

Step1: clone our virtual machine and crash it.

Yes, because we never know! Power off your server, right click on it, select “Clone”:

Let’s name it “TestServer Crash”:

In the next screens select “Full Clone” and “Current Machine State”. Once done, let’s have fun.

Right click on the Crash machine, select “settings”, “Storage” and remove the second hard drive:

now, boot your server. First good news, it boots seamlessly!

Step 2: diagnose the failure

First, we need to pinpoint the failure. Here’s our server, before the crash:

I asked for details using these commands:

For every report, see the “State: active” line or “State: clean” line, and each time the two final lines, saying “active sync” status.
now, with the crashed one:

Oooops, something went wrong! It’s clearly displayed here and need no further explanation, one of our hard drives is missing!
Now what?

Step 3: recover from failure

Ok, nos let’s recreate a hard drive. Use Virtual machine’s setting to do so.

Now, let’s partition it. From here, there are two solutions: the clean, slow one, and the dirty, very fast one. With the first one, you use fdisk and recreate all of your partitions by hand. With the second one, you use partition table cloning. Dirty, but as this is out of this tutorial, I’ll use this way:

With this way you might get some warnings.

Check that everything’s correct:

And now, let’s tell the RAID manager that we have a brand new hard drive to use as a copy of the first one. We must to this partition by partition:

Check that it worked:

Do the same for each partition:


md2 might take a while to rebuild, as it it 245Gib big:

Here it is, 15mn later:

Tadaaaaa, you’re done!