grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* does grub understand LVM raid1 layouts?
@ 2014-08-28 13:31 Bayard Bell
  2014-08-28 15:49 ` Andrei Borzenkov
  2014-09-27  9:00 ` Andrei Borzenkov
  0 siblings, 2 replies; 3+ messages in thread
From: Bayard Bell @ 2014-08-28 13:31 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

In moving my boot device to mirrored LVM under Debian jessie, I ended up
unable to boot. I thought my problem was that I failed to run install-grub
after adding GRUB_PRELOAD_MODULES=lvm to /etc/default/grub, but when I
finally sorted out a working PXE image for rescue, I found that I was
unable to install while mirrored. That appears to be in part because Debian
has taken upgrades to LVM2 that change the default mirroring layout from
"mirror" to "raid1" (mirror_segtype_default = "raid1" in /etc/lvm/lvm.conf;
the lvm pages are also clear on this distinction and the defaults), which
results in an inability to successfully probe /boot/grub, which breaks
grub-install. The clearest indication I could find of this as likely root
cause was a debug message from grub-probe "Unknown LVM format raid1".
Looking at the source head, it appears that there's first a check for raidX
in lines 580-583 of grub-core/disk/lvm.c but that the subsequent switch at
lines 587-600 provides for raid[456] but not raid1, which isn't defined in
include/grub/diskfilter.h.

I'm looking at doing a bit more debug to confirm this before assessing fix
options, but am I on the right track thus far?

Cheers,
Bayard

[-- Attachment #2: Type: text/html, Size: 1329 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: does grub understand LVM raid1 layouts?
  2014-08-28 13:31 does grub understand LVM raid1 layouts? Bayard Bell
@ 2014-08-28 15:49 ` Andrei Borzenkov
  2014-09-27  9:00 ` Andrei Borzenkov
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Borzenkov @ 2014-08-28 15:49 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: buffer.g.overflow

В Thu, 28 Aug 2014 14:31:30 +0100
Bayard Bell <buffer.g.overflow@gmail.com> пишет:

> In moving my boot device to mirrored LVM under Debian jessie, I ended up
> unable to boot. I thought my problem was that I failed to run install-grub
> after adding GRUB_PRELOAD_MODULES=lvm to /etc/default/grub, but when I
> finally sorted out a working PXE image for rescue, I found that I was
> unable to install while mirrored. That appears to be in part because Debian
> has taken upgrades to LVM2 that change the default mirroring layout from
> "mirror" to "raid1" (mirror_segtype_default = "raid1" in /etc/lvm/lvm.conf;
> the lvm pages are also clear on this distinction and the defaults), which
> results in an inability to successfully probe /boot/grub, which breaks
> grub-install. The clearest indication I could find of this as likely root
> cause was a debug message from grub-probe "Unknown LVM format raid1".
> Looking at the source head, it appears that there's first a check for raidX
> in lines 580-583 of grub-core/disk/lvm.c but that the subsequent switch at
> lines 587-600 provides for raid[456] but not raid1, which isn't defined in
> include/grub/diskfilter.h.
> 

Is there functional difference (to the extent grub is using it) between
mirror and raid1 in LVM? If not, just use GRUB_DISKFILTER_MIRROR in
this case.

> I'm looking at doing a bit more debug to confirm this before assessing fix
> options, but am I on the right track thus far?
> 

Yes. Patch is appreciated.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: does grub understand LVM raid1 layouts?
  2014-08-28 13:31 does grub understand LVM raid1 layouts? Bayard Bell
  2014-08-28 15:49 ` Andrei Borzenkov
@ 2014-09-27  9:00 ` Andrei Borzenkov
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Borzenkov @ 2014-09-27  9:00 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: buffer.g.overflow

В Thu, 28 Aug 2014 14:31:30 +0100
Bayard Bell <buffer.g.overflow@gmail.com> пишет:

> In moving my boot device to mirrored LVM under Debian jessie, I ended up
> unable to boot. I thought my problem was that I failed to run install-grub
> after adding GRUB_PRELOAD_MODULES=lvm to /etc/default/grub, but when I
> finally sorted out a working PXE image for rescue, I found that I was
> unable to install while mirrored. That appears to be in part because Debian
> has taken upgrades to LVM2 that change the default mirroring layout from
> "mirror" to "raid1" (mirror_segtype_default = "raid1" in /etc/lvm/lvm.conf;
> the lvm pages are also clear on this distinction and the defaults), which
> results in an inability to successfully probe /boot/grub, which breaks
> grub-install. The clearest indication I could find of this as likely root
> cause was a debug message from grub-probe "Unknown LVM format raid1".
> Looking at the source head, it appears that there's first a check for raidX
> in lines 580-583 of grub-core/disk/lvm.c but that the subsequent switch at
> lines 587-600 provides for raid[456] but not raid1, which isn't defined in
> include/grub/diskfilter.h.
> 
> I'm looking at doing a bit more debug to confirm this before assessing fix
> options, but am I on the right track thus far?
> 

It turned out more straightforward than expected. Could you test patch
below? Lightly tested in user space using grub-probe and grub-fstest
(also in degraded mode).

From: Andrei Borzenkov <arvidjaar@gmail.com>
Subject: [PATCH] add LVM RAID1 support

---
 grub-core/disk/lvm.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
index 862a966..18aca81 100644
--- a/grub-core/disk/lvm.c
+++ b/grub-core/disk/lvm.c
@@ -577,13 +577,17 @@ grub_lvm_detect (grub_disk_t disk,
 		      if (is_pvmove)
 			seg->node_count = 1;
 		    }
-		  else if (grub_memcmp (p, "raid", sizeof ("raid") - 1)
-			   == 0 && (p[sizeof ("raid") - 1] >= '4'
-				    && p[sizeof ("raid") - 1] <= '6')
+		  else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) == 0
+			   && ((p[sizeof ("raid") - 1] >= '4'
+				&& p[sizeof ("raid") - 1] <= '6')
+			       || p[sizeof ("raid") - 1] == '1')
 			   && p[sizeof ("raidX") - 1] == '"')
 		    {
 		      switch (p[sizeof ("raid") - 1])
 			{
+			case '1':
+			  seg->type = GRUB_DISKFILTER_MIRROR;
+			  break;
 			case '4':
 			  seg->type = GRUB_DISKFILTER_RAID4;
 			  seg->layout = GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC;
@@ -608,16 +612,18 @@ grub_lvm_detect (grub_disk_t disk,
 			  goto lvs_segment_fail;
 			}
 
-		      seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
-		      if (p == NULL)
+		      if (seg->type != GRUB_DISKFILTER_MIRROR)
 			{
+			  seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
+			  if (p == NULL)
+			    {
 #ifdef GRUB_UTIL
-			  grub_util_info ("unknown stripe_size\n");
+			      grub_util_info ("unknown stripe_size\n");
 #endif
-			  goto lvs_segment_fail;
+			      goto lvs_segment_fail;
+			    }
 			}
 
-
 		      seg->nodes = grub_zalloc (sizeof (seg->nodes[0])
 						* seg->node_count);
 
@@ -625,7 +631,7 @@ grub_lvm_detect (grub_disk_t disk,
 		      if (p == NULL)
 			{
 #ifdef GRUB_UTIL
-			  grub_util_info ("unknown mirrors\n");
+			  grub_util_info ("unknown raids\n");
 #endif
 			  goto lvs_segment_fail2;
 			}
-- 
tg: (77063f4..) u/lvm-raid1 (depends on: master)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-27  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28 13:31 does grub understand LVM raid1 layouts? Bayard Bell
2014-08-28 15:49 ` Andrei Borzenkov
2014-09-27  9:00 ` Andrei Borzenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).