* grub2 (1.97.1) on RAID0
@ 2009-11-12 10:19 André Fettouhi
2009-11-12 10:59 ` info
0 siblings, 1 reply; 4+ messages in thread
From: André Fettouhi @ 2009-11-12 10:19 UTC (permalink / raw)
To: grub-devel
I'm using Arch Linux 64bit and I want to switch to grub2 since 2.0 is
getting somewhat close. I'm running a RAID0 (using dmraid) setup and I
can't figure out how to install grub2 on RAID0. With the legacy grub I
have to go into the grub command prompt and do the following
# dmsetup mknodes
# grub --device-map=/dev/null
grub> device (hd0) /dev/mapper/raid_set
grub> geometry (hd0) C H S
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
# reboot
how can I do this in grub2?
--
---------------------------------------------------------------
Dr. rer. nat. André Fettouhi, Postdoc.
Center for Phase Equilibria and Separation Processes (IVC-SEP)
DTU Chemical Engineering
Department of Chemical and Biochemical Engineering
Technical University of Denmark
Søltofts Plads
Building 229, room 218
2800 Kgs. Lyngby
Denmark
Telephone: +45-45252978
Fax: +45-45882258
E-Mail: af@kt.dtu.dk
---------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: grub2 (1.97.1) on RAID0
2009-11-12 10:19 grub2 (1.97.1) on RAID0 André Fettouhi
@ 2009-11-12 10:59 ` info
2009-11-12 11:40 ` André Fettouhi
0 siblings, 1 reply; 4+ messages in thread
From: info @ 2009-11-12 10:59 UTC (permalink / raw)
To: The development of GNU GRUB
To bad :)
Its not possible to use dmraid with Grub2 yet.
I had to switch bad to grub1 because its not possible to get it working.
Hopefully some developper wants to implement this :)
Sincerely,
Jean-Louis
On Thu, 12 Nov 2009 11:19:50 +0100, "André Fettouhi"
<a.fettouhi@gmail.com>
wrote:
> I'm using Arch Linux 64bit and I want to switch to grub2 since 2.0 is
> getting somewhat close. I'm running a RAID0 (using dmraid) setup and I
> can't figure out how to install grub2 on RAID0. With the legacy grub I
> have to go into the grub command prompt and do the following
>
> # dmsetup mknodes
> # grub --device-map=/dev/null
> grub> device (hd0) /dev/mapper/raid_set
> grub> geometry (hd0) C H S
>
> grub> root (hd0,0)
> grub> setup (hd0)
> grub> quit
> # reboot
>
> how can I do this in grub2?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: grub2 (1.97.1) on RAID0
2009-11-12 10:59 ` info
@ 2009-11-12 11:40 ` André Fettouhi
2009-11-12 14:32 ` Felix Zielcke
0 siblings, 1 reply; 4+ messages in thread
From: André Fettouhi @ 2009-11-12 11:40 UTC (permalink / raw)
To: The development of GNU GRUB
That sucks big time! <Sad>
info@dupondje.be skrev:
> To bad :)
> Its not possible to use dmraid with Grub2 yet.
>
> I had to switch bad to grub1 because its not possible to get it working.
> Hopefully some developper wants to implement this :)
>
> Sincerely,
> Jean-Louis
>
> On Thu, 12 Nov 2009 11:19:50 +0100, "André Fettouhi"
> <a.fettouhi@gmail.com>
> wrote:
>
>> I'm using Arch Linux 64bit and I want to switch to grub2 since 2.0 is
>> getting somewhat close. I'm running a RAID0 (using dmraid) setup and I
>> can't figure out how to install grub2 on RAID0. With the legacy grub I
>> have to go into the grub command prompt and do the following
>>
>> # dmsetup mknodes
>> # grub --device-map=/dev/null
>> grub> device (hd0) /dev/mapper/raid_set
>> grub> geometry (hd0) C H S
>>
>> grub> root (hd0,0)
>> grub> setup (hd0)
>> grub> quit
>> # reboot
>>
>> how can I do this in grub2?
>>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
---------------------------------------------------------------
Dr. rer. nat. André Fettouhi, Postdoc.
Center for Phase Equilibria and Separation Processes (IVC-SEP)
DTU Chemical Engineering
Department of Chemical and Biochemical Engineering
Technical University of Denmark
Søltofts Plads
Building 229, room 218
2800 Kgs. Lyngby
Denmark
Telephone: +45-45252978
Fax: +45-45882258
E-Mail: af@kt.dtu.dk
---------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: grub2 (1.97.1) on RAID0
2009-11-12 11:40 ` André Fettouhi
@ 2009-11-12 14:32 ` Felix Zielcke
0 siblings, 0 replies; 4+ messages in thread
From: Felix Zielcke @ 2009-11-12 14:32 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 858 bytes --]
Am Donnerstag, den 12.11.2009, 12:40 +0100 schrieb André Fettouhi:
> That sucks big time! <Sad>
>
> info@dupondje.be skrev:
> > To bad :)
> > Its not possible to use dmraid with Grub2 yet.
> >
> > I had to switch bad to grub1 because its not possible to get it working.
> > Hopefully some developper wants to implement this :)
> >
> > Sincerely,
> > Jean-Louis
> >
If you have some /dev/mapper/nvida_ pdc_ or isw_ device you can try
attached patch.
But it's a dirty way to implement it and not really tested.
I haven't checked it with recent releases but at the time I wrote it it
worked with my nvidia dmraid device.
isw_ devices seems to have different formats only one of them is
supported.
And pdc_ worked for Pavel but for someone else on IRC it didn't.
--
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer
[-- Attachment #2: dmraid.patch.5 --]
[-- Type: text/x-patch, Size: 5756 bytes --]
diff --git a/util/getroot.c b/util/getroot.c
index 120ab13..f1bfd4c 100644
--- a/util/getroot.c
+++ b/util/getroot.c
@@ -396,13 +396,38 @@ grub_guess_root_device (const char *dir)
return os_dev;
}
+int
+grub_util_is_dmraid (const char *os_dev)
+{
+ if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/isw_", 16))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/hpt37x_", 19))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/hpt45x_", 19))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/via_", 16))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/lsi_", 16))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/pdc_", 16))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/jmicron_", 20))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/asr_", 16))
+ return 1;
+ else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
+ return 1;
+ return 0;
+}
int
grub_util_get_dev_abstraction (const char *os_dev UNUSED)
{
#ifdef __linux__
/* Check for LVM. */
- if (!strncmp (os_dev, "/dev/mapper/", 12))
+ if (!strncmp (os_dev, "/dev/mapper/", 12) && ! grub_util_is_dmraid (os_dev))
return GRUB_DEV_ABSTRACTION_LVM;
/* Check for RAID. */
diff --git a/util/hostdisk.c b/util/hostdisk.c
index a06ecca..0d94ccd 100644
--- a/util/hostdisk.c
+++ b/util/hostdisk.c
@@ -25,6 +25,7 @@
#include <grub/util/misc.h>
#include <grub/util/hostdisk.h>
#include <grub/misc.h>
+#include <grub/file.h>
#include <stdio.h>
#include <stdlib.h>
@@ -819,6 +820,27 @@ convert_system_partition_to_system_disk (const char *os_dev)
p[4] = '\0';
return path;
}
+ /* If this is a Nvidia fake raid. */
+ if (strncmp ("mapper/nvidia_", p, 14) == 0 && p[22] >= '0' && p[22] <= '9')
+ {
+ p[sizeof ("mapper/nvidia_abcdefgh") - 1] = '\0';
+ return path;
+ }
+ if (strncmp ("mapper/pdc_", p, 11) == 0 && p[20] >= '0' && p[20] <= '9')
+ {
+ p[sizeof ("mapper/pdc_abcdefghi") - 1] = '\0';
+ return path;
+ }
+ if (strncmp ("mapper/isw_", p, 11) == 0 && p[29] >= '0' && p[29] <= '9')
+ {
+ p[sizeof ("mapper/isw_abcdefghij_Volume0") - 1] = '\0';
+ return path;
+ }
+ if (strncmp ("mapper/isw_", p, 11) == 0 && p[27] >= '0' && p[27] <= '9')
+ {
+ p[sizeof ("mapper/isw_abcdefghij_ARRAY") - 1] = '\0';
+ return path;
+ }
}
return path;
@@ -869,6 +891,10 @@ device_is_wholedisk (const char *os_dev)
if (os_dev[len - 1] < '0' || os_dev[len - 1] > '9')
return 1;
+ if (strncmp ("/dev/mapper/isw_", os_dev, 16) == 0 && os_dev[34] == '\0')
+ return 1;
+ if (strncmp ("/dev/mapper/isw_", os_dev, 16) == 0 && os_dev[32] == '\0')
+ return 1;
return 0;
}
#endif
@@ -935,7 +961,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
does not count the extended partition and missing primary
partitions. Use same method as on Linux here. */
{
- char *name;
+ char *name, *os_dev_uuid;
grub_disk_t disk;
int fd;
struct hd_geometry hdg;
@@ -985,7 +1011,44 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
return 0;
}
+ auto int find_partition_by_uuid (const char *name);
+ int find_partition_by_uuid (const char *name)
+ {
+ grub_device_t dev;
+
+ if (name[0] == 'f' && name[1] == 'd'
+ && name[2] >= '0' && name[2] <= '9')
+ return 0;
+
+ dev = grub_device_open (name);
+ if (dev)
+ {
+ grub_fs_t fs;
+
+ fs = grub_fs_probe (dev);
+
+ if (fs && fs->uuid)
+ {
+ char *uuid, *p;
+
+ (fs->uuid) (dev, &uuid);
+ if (grub_errno == GRUB_ERR_NONE && uuid)
+ {
+ if (grub_strcasecmp (uuid, os_dev_uuid) == 0)
+ {
+ p = strchr (name, ',');
+ dos_part = atoi (p);
+ free (uuid);
+ return 1;
+ }
+ free (uuid);
+ }
+ }
+ grub_device_close (dev);
+ }
+ return 0;
+ }
name = make_device_name (drive, -1, -1);
if (MAJOR (st.st_rdev) == FLOPPY_MAJOR)
@@ -1015,28 +1078,60 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
if (hdg.start == 0 && device_is_wholedisk (os_dev))
return name;
- grub_util_info ("opening the device %s", name);
- disk = grub_disk_open (name);
- free (name);
-
- if (! disk)
- return 0;
- grub_partition_iterate (disk, find_partition);
- if (grub_errno != GRUB_ERR_NONE)
+ if (hdg.sectors == 0)
{
- grub_disk_close (disk);
- return 0;
+ FILE *fp;
+ char *free_ptr, *p, *q;
+ int len = 512;
+
+ p = xmalloc (strlen (os_dev) + strlen ("blkid ") + 1);
+ strcpy (p, "blkid ");
+ strcat (p, os_dev);
+ fp = popen (p, "r");
+ free (p);
+ do {
+ p = xmalloc (len);
+ p = fgets (p, len, fp);
+ if (! p)
+ return 0;
+ len *= 2;
+ } while (! strchr (p, '\n'));
+ free_ptr = p;
+ p = strstr (p , "UUID=");
+ if (! p)
+ return 0;
+ p += strlen ("UUID=\"");
+ q = strchr (p, '\"');
+ if (q)
+ *q = '\0';
+ os_dev_uuid = p;
+ pclose (fp);
+ grub_device_iterate (find_partition_by_uuid);
+ free (free_ptr);
}
-
- if (dos_part < 0)
+ else
{
- grub_disk_close (disk);
- grub_error (GRUB_ERR_BAD_DEVICE,
- "cannot find the partition of `%s'", os_dev);
- return 0;
- }
+ grub_util_info ("opening the device %s", name);
+ disk = grub_disk_open (name);
+ free (name);
+ if (! disk)
+ return 0;
+ grub_partition_iterate (disk, find_partition);
+ if (grub_errno != GRUB_ERR_NONE)
+ {
+ grub_disk_close (disk);
+ return 0;
+ }
+ if (dos_part < 0)
+ {
+ grub_disk_close (disk);
+ grub_error (GRUB_ERR_BAD_DEVICE,
+ "cannot find the partition of `%s'", os_dev);
+ return 0;
+ }
+ }
return make_device_name (drive, dos_part, bsd_part);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-12 14:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-12 10:19 grub2 (1.97.1) on RAID0 André Fettouhi
2009-11-12 10:59 ` info
2009-11-12 11:40 ` André Fettouhi
2009-11-12 14:32 ` Felix Zielcke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.