Bug#423022: patch for partmap probing on RAID/LVM
Sam Morris
sam at robots.org.uk
Mon May 28 02:49:11 UTC 2007
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)
if (print == PRINT_PARTMAP)
{
- if (dev->disk->partition == NULL)
- grub_util_error ("Cannot detect partition map for %s", drive_name);
+ if (dev->disk->partition == NULL) {
+ /* If the device does not have a partition map, it may still 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] == 'm' && drive_name[1] == 'd')
+ printf ("pc gpt raid\n");
+ else if (strchr (drive_name, '-') != NULL)
+ printf ("pc gpt lvm\n");
+ else
+ grub_util_error ("Cannot detect partition map for %s", drive_name);
+
+ goto end;
+ }
if (strcmp (dev->disk->partition->partmap->name, "amiga_partition_map") == 0)
printf ("amiga\n");
--
Sam Morris
http://robots.org.uk/
PGP key id 1024D/5EA01078
3412 EA18 1277 354B 991B C869 B219 7FDB 5EA0 1078
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20070528/4455813b/attachment.pgp
More information about the Pkg-grub-devel
mailing list