Restoring a lost RAID array

After an upgrade from Edgy to Feisty my RAID array disappeared (aka, I shit my pants).

Doing a ‘cat /proc/mdstat’ produced:
Personalities : [raid6] [raid5] [raid4]
<none>

Thankfully I had backups of my mdadm.conf and lvm.conf files so I knew that as long as I didn’t alter the data on the drives I could always fall back to Edgy and still have my files.

After trying a few things with mdadm, all unsuccessfully, I decided to uninstall it entirely. So I made a (second) backup of my mdadm.conf and lvm.conf files, and did a:
apt-get –purge remove mdadm lvm2

This uninstalls the packages and also removes the config files (that’s what the –purge option is there for).

After uninstalling them I verified the configs were gone and reinstalled the packages through Synaptic inside of GNOME. During the install it prompted which arrays were required to boot. On my failed upgrade I had configured it with “all” but I really didn’t need my array at boot time, my root partition is on a standalone IDE drive, so this time I told it “none”.

I expected to have more tinkering to do, but after the install I again did a “cat /proc/mdstat” and to my surprise my array was back! *yay*

Now I just had to get my lvm partitions back. I’ve found the Gentoo LVM2 installation guide very usefull, and a good resource for LVM, so I turned to it to see how to recover volumes. The commands to restore my volumes were:
vgscan
vgchange -a y

And voila, my array and it’s partitions were good as new. A quick “mount -a” brought them all up without a glitch!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: