From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1XXnrx-0008Sb-HG for mharc-grub-devel@gnu.org; Sat, 27 Sep 2014 05:00:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXnrn-0008SN-3J for grub-devel@gnu.org; Sat, 27 Sep 2014 05:00:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXnre-0007KZ-1a for grub-devel@gnu.org; Sat, 27 Sep 2014 05:00:35 -0400 Received: from mail-la0-x22d.google.com ([2a00:1450:4010:c03::22d]:39339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXnrd-0007JU-QO for grub-devel@gnu.org; Sat, 27 Sep 2014 05:00:25 -0400 Received: by mail-la0-f45.google.com with SMTP id q1so4111171lam.32 for ; Sat, 27 Sep 2014 02:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=wb0Y/g3YM17B2X+WkhWqJwTPSiY8KoCZQfwxxwg44nY=; b=xs8MJKVYLRsm+FA9AxzcG4leMrkFG8I/0ON5djnY71PUHEAFN7oTiJ/X1QKoVeJ5iI tZXTHxLWhLm/bog8NE5RlI6cR0LAqxy1med7mi60b8c4lm3Nz8r51pLkldWb0ACRjwLp jamE2OG/fkTTfRS8EFFkmMlVfMqcabg1IvG9DtzoLTd86kX6HtFmTBJzjQ67XxVTPBK0 Y1WUc/oMAhU8OGICQ7ns748ZEhEbXAdeCsqWKUJVU/4jFu77KkbJ76BU+IwuXENmmq4f Sh8ONc/po4T+tLLp+coGJehh2b3b4e3mF1CBIyRWnggWxlPYCVv7JOnXKyBjLI31IJd3 Mf5A== X-Received: by 10.112.235.199 with SMTP id uo7mr24586104lbc.50.1411808419637; Sat, 27 Sep 2014 02:00:19 -0700 (PDT) Received: from opensuse.site (ppp94-29-94-89.pppoe.spdop.ru. [94.29.94.89]) by mx.google.com with ESMTPSA id 1sm2687938lao.36.2014.09.27.02.00.18 for (version=SSLv3 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Sep 2014 02:00:18 -0700 (PDT) Date: Sat, 27 Sep 2014 13:00:17 +0400 From: Andrei Borzenkov To: The development of GNU GRUB Subject: Re: does grub understand LVM raid1 layouts? Message-ID: <20140927130017.0d63a534@opensuse.site> In-Reply-To: References: X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.23; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22d Cc: buffer.g.overflow@gmail.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Sep 2014 09:00:44 -0000 =D0=92 Thu, 28 Aug 2014 14:31:30 +0100 Bayard Bell =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > 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=3Dlvm 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 Debi= an > has taken upgrades to LVM2 that change the default mirroring layout from > "mirror" to "raid1" (mirror_segtype_default =3D "raid1" in /etc/lvm/lvm.c= onf; > 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 rai= dX > 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. >=20 > 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? >=20 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 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 =3D 1; } - else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) - =3D=3D 0 && (p[sizeof ("raid") - 1] >=3D '4' - && p[sizeof ("raid") - 1] <=3D '6') + else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) =3D=3D 0 + && ((p[sizeof ("raid") - 1] >=3D '4' + && p[sizeof ("raid") - 1] <=3D '6') + || p[sizeof ("raid") - 1] =3D=3D '1') && p[sizeof ("raidX") - 1] =3D=3D '"') { switch (p[sizeof ("raid") - 1]) { + case '1': + seg->type =3D GRUB_DISKFILTER_MIRROR; + break; case '4': seg->type =3D GRUB_DISKFILTER_RAID4; seg->layout =3D GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC; @@ -608,16 +612,18 @@ grub_lvm_detect (grub_disk_t disk, goto lvs_segment_fail; } =20 - seg->stripe_size =3D grub_lvm_getvalue (&p, "stripe_size =3D "); - if (p =3D=3D NULL) + if (seg->type !=3D GRUB_DISKFILTER_MIRROR) { + seg->stripe_size =3D grub_lvm_getvalue (&p, "stripe_size =3D "); + if (p =3D=3D 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; + } } =20 - seg->nodes =3D grub_zalloc (sizeof (seg->nodes[0]) * seg->node_count); =20 @@ -625,7 +631,7 @@ grub_lvm_detect (grub_disk_t disk, if (p =3D=3D NULL) { #ifdef GRUB_UTIL - grub_util_info ("unknown mirrors\n"); + grub_util_info ("unknown raids\n"); #endif goto lvs_segment_fail2; } --=20 tg: (77063f4..) u/lvm-raid1 (depends on: master)