Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have recently added a drive to a system and have successfully raid'ed (RAID-1) the paritions, with the exception of the boot partition. I have it ready and mirrored, but can't get GRUB2 (update-grub) to find it.

System: Ubuntu 11.04 Raid Metadata: 1.2

If I run update-grub, it finds the kernel images on the /dev/sda2 partition (present root) but not the images on /dev/md127.

/dev/md127 is composed of "missing" and "/dev/sdb2".

fdisk on /dev/sdb confirms that sdb2 is of type fd (raid autodetect) and is also flagged bootable.

I have two things I want to do.

  1. Make the boot.cfg on /dev/sdb2 have a menu option to have the root be /dev/md127
  2. Install grub onto /dev/md127 so the actual boot.cfg from there is being used.

Disk partitions:

$ sudo sfdisk -l /dev/sda

Disk /dev/sda: 30394 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1          0+     13      14-    112423+  de  Dell Utility
/dev/sda2   *     14    7837    7824   62846280   83  Linux
/dev/sda3       7838    8882    1045    8393962+  82  Linux swap / Solaris
/dev/sda4       8883   30393   21511  172787107+   5  Extended
/dev/sda5       8883+  30393   21511- 172787076   83  Linux

$ sudo sfdisk -l /dev/sdb

Disk /dev/sdb: 30394 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+     13      14-    112423+  de  Dell Utility
/dev/sdb2   *     14    7837    7824   62846280   fd  Linux raid autodetect
/dev/sdb3       7838    8882    1045    8393962+  82  Linux swap / Solaris
/dev/sdb4       8883   30393   21511  172787107+   5  Extended
/dev/sdb5       8883+  30393   21511- 172787076   fd  Linux raid autodetect

The thing to note here is that /dev/sdb2 is part of a raid, while /dev/sda2 is not. /dev/sda2 is the present non-raid boot that works fine. I would like to switch to a raid boot and when that is good, convert sda2 to raid and add it to the "missing" raid drive.

$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md5 : active raid1 sda5[2] sdb5[1]
      172785980 blocks super 1.2 [2/2] [UU]

md127 : active raid1 sdb2[1]
      62846208 blocks [2/1] [_U]

The tail end of mdadm.conf. This was auto-generated by /usr/share/mdadm/mkconf

# This file was auto-generated on Thu, 30 Jun 2011 14:38:15 -0500
# by mkconf $Id$
ARRAY /dev/md127 UUID=352d87d1:23d5c92d:04cfec0a:0340cbb1
ARRAY /dev/md/5 metadata=1.2 UUID=7ea17a90:6cbf0816:feef74da:5fa4f88a name=ramuh:5

The grub.cfg file that boots fine from /dev/sda2

    menuentry 'Ubuntu, with Linux 2.6.38-11-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        set gfxpayload=$linux_gfx_mode
        insmod part_msdos
        insmod ext2
        set root='(/dev/sda,msdos2)'
        search --no-floppy --fs-uuid --set=root 7bbe19ee-c62c-4674-b0ca-281d1cedac00
        linux   /boot/vmlinuz-2.6.38-11-generic-pae root=UUID=7bbe19ee-c62c-4674-b0ca-281d1cedac00 ro   quiet splash vt.handoff=7
        initrd  /boot/initrd.img-2.6.38-11-generic-pae

Thanks!

share|improve this question
    
BTW, I have already searched and found a metadata issue like this where grub 2 used to require metadata 0.9. However, that is old news and all that I see now recommends metadata 1.2. –  sleeves Jul 1 '11 at 14:42
    
Can you post your full grub config used for booting? –  Nils Aug 9 '11 at 21:22
    
Sorry, but I haven't gotten around to posting it. I could be wrong, but do you think the problem could be in there? That file is not used for scanning, right? It is an output that is auto-generated. I'll still post it if you think it will help. –  sleeves Sep 22 '11 at 22:14
1  
Propably not. But I think there is a error in your thoughts. How can grub find a soft-mirror-device to load the initrd while the initrd contains the code for the soft-mirror? IMO the raid can only be active AFTER the initrd has been loaded. Thus you can`t install grub on md127 (because it is not a physical disk known by grub). –  Nils Sep 23 '11 at 20:00
1  
Next question that arises is - why is your raid1 not started after booting? Does your mdadm.conf contain the right content and is sda2 also set up as raid auto-detect? –  Nils Sep 23 '11 at 20:03

2 Answers 2

up vote 1 down vote accepted

Grub2 now has some understanding for md devices. It should be provided via loadable modules as necessary.

Make sure that your system understands that it needs the md devices to boot. Ensure all arrays are listed in /etc/mdadm/mdadm.conf and run:

# dpkg-reconfigure mdadm

(nb: I recently has to something similar on my Debian system, but it ought to apply for Ubuntu as well)

share|improve this answer
    
Thanks. Here is what I am in the process of doing. 1) dpkg-reconfigure mdadm (make sure no errors) 2) mount /dev/md/127 /newroot 3) rsync -avx / /newroot/ 4) grub-mkconfig (I don't expect this to find the raid) 5) reboot and manually change root= to point to /dev/md/127 6) grub-mkconfig (I expect this to find the raid and update grub.cfg to load the proper modules) –  sleeves Sep 28 '11 at 1:52
1  
Don't use /dev/md/127, use /dev/md127. Why is it showing up as /dev/md127 and not, say, /dev/md0? Probably not a big deal. –  MikeyB Sep 28 '11 at 2:21
    
Thanks Mikey. Not going well. I did many things and none of them boot right. /dev/md127 was something weird that I wondered about. The other partition is /dev/md5 and md127 was once /dev/md2 but on some reboot it decided to change. NOTE: grub-rescue cannot see the raid drives. I type: insmod raid and insmod mdraid09 and ls and see nothing but hd0 drives. Again, the only way to get it to boot is to change the BIOS boot to the second drive which has the original non-raid boot setup. I then can change root=/dev/md127 and it boots fine. –  sleeves Sep 28 '11 at 3:16
    
Can you post your complete partitioning? And /proc/mdstat, /etc/mdadm/mdadm.conf? Something's not quite right. –  MikeyB Sep 28 '11 at 3:39
    
Thanks for looking into this. I've added all above. –  sleeves Sep 28 '11 at 13:19

At the grub menu, press 'e' to edit the menu entry and manually change the root= kernel argument to point to the raid array and boot from it manually. Then run update-grub, and it will see that you are currently booting from the raid array and configure itself to do so in the future.

Also, you don't need to have a separate /boot partition.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.