How to recover a three disk Ubuntu software RAID5 array

Hey there,

I'm building an Ubuntu 10.04 virtual machine server.  I have three 500GB SATA drives which I setup in a RAID5 configuration.  The setup went fairly easily and I installed the OS without a problem.  

Before I start setting everything up, I want to make sure that if I lose one of the drives I know how to recover.  For my dry run, I removed one of the drives, connected it to my laptop with a SATA USB docking station, and deleted the partitions from it.  

I physically reinstalled the drive in my server and tried to boot.  During boot I'm prompted to start the degraded RAID.  I say yes to that and I get the following:

mdadm: CREATE user root not found
mdadm: CREATE group disk not found
raid5: raid level 5 set md0 active with 2 out of 3 devices, algorithm 2
mdadm: /dev/md0 has been started with 2 drives (out of 3)
raid5: failed to run raid set md1
mdadm: failed to RUN-ARRAY /dev/md1: Input.output error
mdadm: Not enough devices to start the array while not clean - consider --force
Started the RAID in degraded mode
Gave up waiting for root device:
*then a list of common problems and then:

ALERT! /dev/disk/by-uuid/bunchanumbersnad letters does not exist.  Dropping to a shell!
Then I get a busybox shell and a prompt of "initramfs".  

So, the question is, how would I go about rebuilding the third drive in the array?  Can I boot to a live CD and do something there?  Is there something I can do at the initramfs prompt?

Glad I'm not trying to figure this out on a failed production box!  Yay for dry runs! :P

Thanks in advance for any help.  
Who is Participating?
I think by default on the new Ubuntu installs, the GRUB menu is hidden.  Hold down the <SHIFT> key while it is booting to see the GRUB menu.

To answer your question about the tutorials, Linux before had trouble booting from RAID, so many would put at least the /boot partition on a non-RAID portion of the drive.  Also, many would consider the data as the most important for the redundancy.

After you set the configuration of bootdegraded=true did it come up?
Looks like you never set it up properly to begin with.   /dev/md0 looks golden, it sees 2 out of 3 disks.

/dev/md1 (which would be the other partition) should have had exactly the same output.   So you must have done something differently when you set that up, or perhaps you never formatted it.  Look at the config files.  What is different between the two?
ttist25Author Commented:
Config file?  I didn't see no stinking config file!


Where would I find them?  Is it accessible via the initramfs thing?  I'm just knowledgeable enough about Linux to be dangerous.  I guess I've spread my wings and left the nest but I'm getting jacked up by some branches on the way down!  

When I set it up I used the instructions here.

Everything went as described in that document except that it states:
If you choose to place the root partition on a RAID array, the installer will then ask if you would like to boot in a degraded state. See the section called “Degraded RAID” for further details.
and I didn't get asked about booting in a degraded state at that point.  

Maybe I should try starting over to make sure I didn't miss something?

Thanks for the help.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

do you have a copy of your /etc/fstab?  that would help us.

If you did follow the guide that you pointed to, the md0 that came up is just the swap partition.  The md1 is the root partition that doesn't want to boot in a degraded state.  When GRUB comes up, hit "e" to edit and then choose the "kernel" line and "e" to edit it.  Append "bootdegraded=true" (without the quotes) to the kernel line and then boot the box.  Does it come up now?
ttist25Author Commented:
Sorry - I started from scratch again before I saw your response.  I followed these instructions to the letter except that I selected RAID5 rather than RAID1 and I formatted three drives with a swap and / partition instead of two.  

Also this time, after I got the OS installed, I opened up a terminal and did "sudo dpkg-reconfigure mdadm" to set bootdegraded to true and also set the notification email.  

I rebooted, shutdown, and disconnected power to drive 1 (sdb).  Then I started the box and tried hitting "e" after POST but I don't ever see GRUB.  I'm not sure I see grub menu's even with all three drives running normally.  Although I know grub is installed - there's no other OS or bootloader.  

Maybe I'm missing something fundamental.  For instance, all of the RAID5 tutorials I've seen reference at least 4 drives.  One is for the OS (and is sometimes mirrored with a 5th drive in RAID1) and the other three are used for the array.  I'm installing the OS on my RAID5 array.  Is this the reason it can't boot degraded?

I've got to have this server be able to run in a degraded state as an entire satellite office (6 users) will be connecting via RDP to the VM's on it.  The office is about 1-1/2 hours from me so I need to have that redundancy so they can continue to run until I can get there and fix it.  

If I reconnect the drive and boot would the fstab still help you?  Just let me know and I'll post it right away.

Thanks SO much for your help.  I'm really getting frustrated trying to get this working and it's nice to have you guys there for support.  

Thanks again.  
ttist25Author Commented:
Nope.  Didn't come up even with bootdegraded set to true.  That said, even without setting bootdegraded to true, I get an option that asks if I want to boot degraded.

Right now it's sitting with sdb disconnected and sitting at an initramfs prompt.  I'll try rebooting and see if I can get the grub menu.  

Is there anything else I can provide for you?

ttist25Author Commented:
I was in an Ubuntu IRC chat and someone there stated that the OS can't be on the array in RAID5.  Do you know if that's true?
ttist25Author Commented:
Hey guys,

Thanks for the help but I've given up on RAID5.  For my application I think a RAID1 setup is the way to go.  It provides sufficient fault tolerance for my application and will keep the server running long enough for me to add a new drive.  

RAID5 in theory (better read times, greater storage space, etc) would've been better for my application but, there doesn't seem to be strong consensus in the community in the ability to install the OS on the array and recover and I see more nightmares than solutions in the available resources.  

I used this tutorial to set it up and test it.  Worked well.  

I setup RAID1, disconnected sdb, removed sdb, booted, added sdb and it built and runs fine.  

Keep it simple I guess.  Time to move on.

Thanks again for your efforts.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.