LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Migrating to Software RAID (https://www.linuxquestions.org/questions/linux-general-1/migrating-to-software-raid-164270/)

waster 03-30-2004 03:24 PM

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):
lba32
boot=/dev/md2
raid-extra-boot=/dev/hde,/dev/hdg
root=/dev/md5

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,
Jack

GregLee 03-31-2004 01:17 AM

My root is on /dev/md0, a raid1 array built from /dev/hda6 and
/dev/hdc13. A portion of my lilo.conf is:
Quote:

# 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.

martijnkr 04-29-2004 02:47 AM

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:
http://www.tldp.org/HOWTO/Software-R...O-7.html#ss7.3
http://www.rot13.org/~dpavlin/md-raid5.html
http://www.devil-linux.org/newdoc/ch01s05.html

Cheers,

-Martijn

waster 04-29-2004 09:30 AM

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

raid-extra-boot=/dev/hda,/dev/hdb

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...


All times are GMT -5. The time now is 12:49 AM.