On Mon, 2007-05-28 at 03:49 +0100, Sam Morris wrote: > 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.
I assume this isn't complete or working yet. By the way I don't think that LVM on LVM is actually supported by LVM itself, and raid on LVM is an unlikely scenario. > > 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"); > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel -- Daniel Reurich Centurion Computer Technology (2005) Limited. Ph: 021 797 722 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel