Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1HsViW-00014E-Ei for mharc-grub-devel@gnu.org; Sun, 27 May 2007 23:16:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HsViV-00013D-Lc for grub-devel@gnu.org; Sun, 27 May 2007 23:16:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HsViU-00010t-39 for grub-devel@gnu.org; Sun, 27 May 2007 23:16:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HsViT-00010h-UF for grub-devel@gnu.org; Sun, 27 May 2007 23:16:17 -0400 Received: from crypt.ethx.net ([82.165.27.140]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HsVM6-0005Nt-JJ for grub-devel@gnu.org; Sun, 27 May 2007 22:53:11 -0400 Received: from 62-31-146-25.cable.ubr12.azte.blueyonder.co.uk ([62.31.146.25] helo=xerces) by crypt.ethx.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1HsVM2-0008OG-O1; Mon, 28 May 2007 03:53:07 +0100 Received: from sam by xerces with local (Exim 4.63) (envelope-from ) id 1HsVIF-0002i4-Ra; Mon, 28 May 2007 03:49:11 +0100 From: Sam Morris To: 423022@bugs.debian.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-adm9tL45eqdv2zY7hQoT" Date: Mon, 28 May 2007 03:49:11 +0100 Message-Id: <1180320551.24543.8.camel@xerces> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 X-Spam-Bars: - X-detected-kernel: Linux 2.6 (newer, 3) Cc: grub-devel@gnu.org Subject: patch for partmap probing on RAID/LVM X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2007 03:16:19 -0000 --=-adm9tL45eqdv2zY7hQoT Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Here's the beginning of a patch for grub-probe itself to make it handle RAID/LVM more intelligently. This will work for the most common use-cases; the comments describe an idea to make the probing process recursive to handle more interesting situations such as LVM-on-RAID. diff --git a/util/grub-probe.c b/util/grub-probe.c index 29d0d0a..8e10986 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -118,8 +118,36 @@ probe (const char *path) =20 if (print =3D=3D PRINT_PARTMAP) { - if (dev->disk->partition =3D=3D NULL) - grub_util_error ("Cannot detect partition map for %s", dri= ve_name); + if (dev->disk->partition =3D=3D NULL) { + /* If the device does not have a partition map, it may sti= ll be a + RAID or LVM device. */ + /* What happens for LVM-on-RAID, or RAID-on-LVM, or nested= LVM? + Maybe this should be recursive, e.g.: + + Where (md0) consists of two devices: a whole disk and a= pc partition: + probe_partmap (md0) + probe_partmap (hd0) -> raid + probe_partmap (hd1,1) -> raid + probe_partmap (hd1) -> pc + + Where (foo-bar) is an LVM Logical Volume on a RAID array= on disks using + gpt partitions: + probe_partmap (foo-bar) + probe_partmap (md0) -> lvm + probe_partmap (hd0,1) + probe_partmap (hd0) -> gpt + probe_partmap (hd1,1) + probe_partmap (hd1) -> gpt + */ + if (drive_name[0] =3D=3D 'm' && drive_name[1] =3D=3D 'd') + printf ("pc gpt raid\n"); + else if (strchr (drive_name, '-') !=3D NULL) + printf ("pc gpt lvm\n"); + else + grub_util_error ("Cannot detect partition map for %s", d= rive_name); + + goto end; + } =20 if (strcmp (dev->disk->partition->partmap->name, "amiga_part= ition_map") =3D=3D 0) printf ("amiga\n"); --=20 Sam Morris http://robots.org.uk/ PGP key id 1024D/5EA01078 3412 EA18 1277 354B 991B C869 B219 7FDB 5EA0 1078 --=-adm9tL45eqdv2zY7hQoT Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBGWkMnshl/216gEHgRAsV4AKDoDaNewXRqGVF4TAFPiJRNnBDmjgCg8sNw FUtKrEgRbrQXk8iJ9kIe2nQ= =urUe -----END PGP SIGNATURE----- --=-adm9tL45eqdv2zY7hQoT--