Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-30-2004, 04:24 PM   #1
Registered: Jan 2004
Location: London
Distribution: Debian
Posts: 33

Rep: Reputation: 15
Migrating to Software RAID

I must have read 150 howtos,faqs,docs and postings, but I really have made no progress. Please help me boot my system directly into RAID.

System is a Debian box, running kernel 2.6.4. I'm trying to convert the two IDE hard disks to run as a mirrored RAID1 array, attached to the onboard PROMISE fasttrak controller. Despite the PROMISE controller, this is effectively a Software RAID solution, as the kernel just sees two IDE devices. I want to mirror all the partitions, although I'd be happy to let /boot be separate if necessary.

On boot, I get the following error:

md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
VFS: Cannot open root device "905" or md5
Please append a correct "root=" boot option
Kernel panic: VFS: unable to mount root fs on md5

So, no raid arrays are detected. The partitions have hex code 'fd' (linux raid autodetect).

Each partition boot,root,usr and var is mirrored exactly on the other disk. This is all fine, and under KNOPPIX, I can use mdadm to set up the arrays, mount them, and everything works as expected. My kernel has everything appropriate compiled in: md, raid1, ext2, ext3 and so on, and I boot it directly, not via initrd.

An excerpt from my lilo.conf is at the moment (although I've made many changes):

lilo runs successfully, but evidently, the raid device isn't available at boot time on device major number 9. I didn't assign md0 or md1: is this the problem? I matched the mdx numbers to the original partition numbers.

Please can anyone point me in the right direction?

Many thanks,
Old 03-31-2004, 02:17 AM   #2
Registered: Feb 2004
Location: Waimanalo, HI
Distribution: Slackware 10, Fedora 6
Posts: 308

Rep: Reputation: 30
My root is on /dev/md0, a raid1 array built from /dev/hda6 and
/dev/hdc13. A portion of my lilo.conf is:
# Linux bootable partition config begins
image = /boot/bzImage
root = /dev/md0
append = "md=0,/dev/hda6,/dev/hdc13"
label = Linux
# Linux bootable partition config ends
The bzImage in /boot is on an ordinary partition, not a raid array.
It works.

Last edited by GregLee; 03-31-2004 at 02:20 AM.
Old 04-29-2004, 03:47 AM   #3
LQ Newbie
Registered: Apr 2004
Posts: 1

Rep: Reputation: 0
I had a hard time figuring out why I couldn't specify an md device in grub as a root device. It turned out that for some reason my kernel does not automatically recognize the md partitions as possible candidates for a raid array rebuild.

This is the normal type of boot:

Apr 12 07:24:02 woodpecker kernel: md: Autodetecting RAID arrays.
Apr 12 07:24:02 woodpecker kernel: md: autorun ...
Apr 12 07:24:02 woodpecker kernel: md: considering hdd10 ...
Apr 12 07:24:02 woodpecker kernel: md: adding hdd10 ...

And this is (about) what I got:

md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
VFS: Cannot open root device "md2" or unknown-block(0,0)
Please append a correct "root=" boot option
Kernel panic: VFS: Unable to mount root fs on unknown-block(0,0)

The solution to this is to add a specific hint to grub to consider the boot partition to be candidates:

# RAID boot
title root (hd0,0) 2.6.6-0 root RAID boot
root (hd0,0)
kernel /vmlinuz-2.6.6-0 root=/dev/md2 md=2,/dev/hda2,/dev/hdc2

See more info in the kernel documentation: /usr/src/linux/Documentation/md.txt

More stuff on RAID that might be helpful here:


Old 04-29-2004, 10:30 AM   #4
Registered: Jan 2004
Location: London
Distribution: Debian
Posts: 33

Original Poster
Rep: Reputation: 15
I found the issue was that the partition type should be hex: "FD" (Linux RAID autodetect)

Also worth remembering that you must format the arrayed partition AFTER assembling it. You can't format to ext2/3 partitions then raid 1 them together.

Finally, it was fiddly to set up lilo to work correctly when mid-migration to RAID 1. I found that the


line failed if all of the arrays were degraded and on hdb only. simple to solve by adding a partition to the array from hda. However, it is wise to boot up into the degraded arrays on your second drive, so if it goes tits up then you can resume (via knoppix) on hda with the original data. If you trust your backups, then you can do it all in one go:

1) mirror partion table onto second drive (dd and sfdisk for extended partitions)
2) set partition types on second drive to FD
2) create raid array using "missing" instead of /dev/hdaX
3) format the raid partitions ( mkfs.ext2 /dev/mdX )
4) cp -ax each of your original partitions to the analogous raid partion. You don't have to have md0, md1,md2. I use mdX where X is the same number as the original partition(s).
5) init 1
6) unmount var, usr home and whatever else, then remount the RAID partitions in their place
6b) (this is the brave bit) add the hdaX partitions to the array. This is where your original data could be lost. Once added, they will sync (please wait). Root can't be done straight away because you can't remount to a different device, so leave it degraded. DO cp -ax /* /mnt/newrootmdX (-x keeps within the original partition/fs)
7) update /etc/fstab to replace hda/bX for mdX as appropriate
8) update lilo.conf using mdX for the boot partition, and mdY for the root.
9) lilo
10) i had some issue which meant I had to use lilo -A /dev/hd(a|b) , lilo -M, /dev/hd(a|b) but it all worked in the end
11) change partition type of hda raid partitions to FD
12) should be able to reboot, if kernel has compiled in RAID (and device manager stuff needed to run lilo, at least in 2.6 kernel)
13) finally, add hdaX to the degraded root partition
14) should be in full working state now. try bonnie++ to benchmark the array...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
migrating windows raid to linux sigmaes Linux - Hardware 1 11-05-2005 04:45 PM
Migrating single drive to RAID / LVM? joadoor Linux - Hardware 3 10-14-2005 08:01 AM
Migrating from IDE to LSI Logic SCSI RAID -- how? dalchri Linux - Hardware 1 05-20-2005 04:14 PM
Migrating Software to Linux decentpakistani Programming 1 05-08-2005 01:03 AM
Suggestions for Migrating to Open Source Software andersoc Linux - Software 1 03-13-2004 02:56 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration