Bug 841452

Summary: Grub picks bad root device when using mdadm raid1
Product: Red Hat Enterprise Linux 6 Reporter: Phil Anderson <pza>
Component: grubAssignee: Václav Pavlín <vpavlin>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: atodorov, pasteur
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-03 08:53:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Phil Anderson 2012-07-19 04:02:12 UTC
When installing grub on a raid1 boot device, grub-install doesn't make a sensible choice about which device to use as the root device.  This can lead to booting being unnecessarily dependent on both drives in a mirrored configuration.

In my example, I have /dev/md0 made up of a raid1 array of /dev/sda1 & /dev/sdb1 which is mounted as /boot.

When I run grub-install /dev/md0 or /dev/sda, it uses (hd1,0) as the root drive, due to mdadm arbitrarily returning /dev/sdb1 as the first device in the array.  This due to the following code in grub-install:
# There's not a real root device, so just pick the first
if is_raid1_device $root_device ; then
    root_device=`find_real_devs $root_device | awk '{print $1}'`
fi

As grub (installed on the first disk) is looking for the second disk, I am unable to boot should the second disk fail.

grub-install could be smartened up to prefer a root_device on the same disk which we are installing grub on, or possibly the lower numbered disk (assuming that if disk 0 fails, disk 1 becomes disk 0).  This would make booting after single a disk failure much more likely to succeed for simple mirrored configurations.

Comment 2 Vladimir Serbinenko 2012-08-01 17:54:14 UTC
This issue can't be solved reliably without UUIDs. Adding UUIDs to GRUB Legacy is possible (see e.g. Ubuntu patchs) it feels like an overkill for this old code and creates other problems which need hints to be solved.

Comment 3 Václav Pavlín 2012-12-06 13:40:13 UTC
Hi, would this solve your issue, Phil:
http://lists.us.dell.com/pipermail/linux-poweredge/2003-July/008898.html

As Vladimir writes it would be probably overkill to implement this to Grub Legacy. If How-To from link works for you, I will close this bug.

Comment 4 Phil Anderson 2012-12-07 01:01:13 UTC
Unfortunately I don't have time at the moment to test that, but it sounds like it would work.  I simply tweaked grub-installer and hard coded root_device.  Not a proper solution, but it was quick and easy.

Comment 6 Václav Pavlín 2013-04-02 12:00:19 UTC
Phil, any news about the How-To? Can I close this bz?

Comment 7 Phil Anderson 2013-04-02 23:07:36 UTC
Feel free to close it if you want.  I manually changed grub_installer to effectively do what the How-To does and it worked fine.  I

Comment 8 Samantha N. Bueno 2015-10-23 13:59:01 UTC
*** Bug 1260540 has been marked as a duplicate of this bug. ***