In these days i’m playing a lot with mdadm and grub on Linux. I need to learn how make a root disks mirror starting from /dev/sd* booting devices.
During the tasks i did, I encoutered a problem with grub. I had:
– hd0 (sda)
– hd1 (sdb)
/dev/md1 -> /dev/sdb1 ( /boot )
/dev/md3 -> /dev/sdb3 ( / )
/dev/md2 -> /dev/sdb2 ( swap )
I edited /boot/grub/grub.conf as follow:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda3
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
fallback=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS MD (2.6.32-279.el6.x86_64)
root (hd1,0)
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/md3 rd_NO_LUKS LANG=en_US.UTF-8 KEYBOARDTYPE=pc KEYTABLE=it rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-279.el6.x86_64.img
title CentOS (2.6.32-279.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=7c1ba3b1-756c-4124-9079-d11a32ceea78 rd_NO_LUKS LANG=en_US.UTF-8 KEYBOARDTYPE=pc KEYTABLE=it rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-279.el6.x86_64.img
After i tried to run:
[root@localhost grub]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,0)
root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
Checking if “/boot/grub/stage1” exists… no
Checking if “/grub/stage1” exists… yes
Checking if “/grub/stage2” exists… yes
Checking if “/grub/e2fs_stage1_5” exists… yes
Running “embed /grub/e2fs_stage1_5 (hd0)”… 27 sectors are embedded.
succeeded
Running “install /grub/stage1 (hd0) (hd0)1+27 p (hd0,0)/grub/stage2 /grub/grub.conf”… succeeded
Done.
grub> root (hd1,0)
root (hd1,0)
Filesystem type unknown, partition type 0xfd
grub> setup (hd1)
setup (hd1)
Error 1: Cannot mount selected partition
grub>
Looking on the web i found that the problem is with md devices metadata.
I maked them with:
mdadm –create /dev/md1 –level=1 –raid-disks=2 –metadata=default missing /dev/sdb1
default metadata is 1.2 , and it’s incompatible with GRUB!
So for boot disks the solution is make them with:
mdadm –create /dev/md1 –level=1 –raid-disks=2 –metadata=0.90 missing /dev/sdb1