So I'm trying to RAID-1 this system which has two identical disks installed in it, and it isn't working for some reason.
I started by doing a CentOS-4 install on /dev/sda1 as root, and with /dev/sda2 as my swap.
I finish the install, yum update, and then I want to make the mirrors.
I copy the partition table from one disk to the other:
# sfdisk -d /dev/sda | sfdisk /dev/sdb
I create my metadevices:
# mdadm -Cv -l1 -n2 /dev/md1 /dev/sdb1 missing # mdadm -Cv -l1 -n2 /dev/md2 /dev/sdb2 missing
I create my filesystems:
# mkfs.ext3 /dev/md1 # mkswap /dev/md2
I change the /etc/fstab to use /dev/md1 for / and /dev/md2 for swap.
I change the /etc/grub.conf to use /dev/md1 for the root= parameter on my kernel.
I build myself a new initrd for the kernel I want to boot.
I copy the contents of / over to the one-armed mirror:
# cd / # mnt /dev/md1 /mnt/md1 # tar cfpl - . | ( cd /mnt/md1 ; tar xfp -) # umount /mnt/md1 # sync
I run grub just in case:
# grub
device (hd0) /dev/sda root (hd0,0) setup (hd0)
I reboot, expecting that the system will find /dev/md1 and use it as its root... but it doesn't. Digging around in hobbled mode (changing the root= parameter in grub to /dev/sda1 instead of /dev/md1) shows that /dev/md1 doesn't get assembled, therefore it doesn't get mounted.
Can anyone tell me what I've done wrong?
on 9/25/2007 9:44 AM David Mackintosh spake the following:
So I'm trying to RAID-1 this system which has two identical disks installed in it, and it isn't working for some reason.
I started by doing a CentOS-4 install on /dev/sda1 as root, and with /dev/sda2 as my swap.
I finish the install, yum update, and then I want to make the mirrors.
I copy the partition table from one disk to the other:
# sfdisk -d /dev/sda | sfdisk /dev/sdb
I create my metadevices:
# mdadm -Cv -l1 -n2 /dev/md1 /dev/sdb1 missing # mdadm -Cv -l1 -n2 /dev/md2 /dev/sdb2 missing
I create my filesystems:
# mkfs.ext3 /dev/md1 # mkswap /dev/md2
I change the /etc/fstab to use /dev/md1 for / and /dev/md2 for swap.
I change the /etc/grub.conf to use /dev/md1 for the root= parameter on my kernel.
I build myself a new initrd for the kernel I want to boot.
I copy the contents of / over to the one-armed mirror:
# cd / # mnt /dev/md1 /mnt/md1 # tar cfpl - . | ( cd /mnt/md1 ; tar xfp -) # umount /mnt/md1 # sync
I run grub just in case:
# grub
device (hd0) /dev/sda root (hd0,0) setup (hd0)
I reboot, expecting that the system will find /dev/md1 and use it as its root... but it doesn't. Digging around in hobbled mode (changing the root= parameter in grub to /dev/sda1 instead of /dev/md1) shows that /dev/md1 doesn't get assembled, therefore it doesn't get mounted.
Can anyone tell me what I've done wrong?
The partitions need to be type fd (raid autodetect) to work properly on boot. It is much easier to set this up in the initial install.
You can migrate, but it takes a few more steps to be sucessful. Look at the raid howto, I think it has all the steps to migrate.
On Tue, Sep 25, 2007 at 09:56:34AM -0700, Scott Silva wrote:
The partitions need to be type fd (raid autodetect) to work properly on boot. It is much easier to set this up in the initial install.
/me slaps head
That's even in my notes, but I skipped it because I thought "I don't have to mess around with fdisk any more because I can use the sfdisk trick!"
My own fault for going too fast.
Thanks
on 9/25/2007 10:25 AM David Mackintosh spake the following:
On Tue, Sep 25, 2007 at 09:56:34AM -0700, Scott Silva wrote:
The partitions need to be type fd (raid autodetect) to work properly on boot. It is much easier to set this up in the initial install.
/me slaps head
That's even in my notes, but I skipped it because I thought "I don't have to mess around with fdisk any more because I can use the sfdisk trick!"
My own fault for going too fast.
Thanks
No problem.
On 9/25/07, David Mackintosh David.Mackintosh@xdroop.com wrote:
I copy the contents of / over to the one-armed mirror:
# cd / # mnt /dev/md1 /mnt/md1 # tar cfpl - . | ( cd /mnt/md1 ; tar xfp -)
??? you made a copy of /mnt/md1 into /mnt/md1/mnt/md1 ??? use # tar cfpl - --one-file-system . | .... instead
# umount /mnt/md1 # sync
On Tue, Sep 25, 2007 at 08:16:20PM +0200, Alain Spineux wrote:
??? you made a copy of /mnt/md1 into /mnt/md1/mnt/md1 ??? use # tar cfpl - --one-file-system . | .... instead
I think you mean
# tar cfp --one-file-system - . | ...
...but in any case -l is a soon-to-be-depreciated way of writing --one-file-system.
:)