* [PATCH] use UUID to map system devices to grub devices
@ 2009-07-26 14:05 Felix Zielcke
2009-07-28 18:12 ` Robert Millan
0 siblings, 1 reply; 17+ messages in thread
From: Felix Zielcke @ 2009-07-26 14:05 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 768 bytes --]
As requested by Robert on IRC, this is a split from my dmraid patch.
On dmraid devices HDIO_GETGEO returns 0 for all fields, so the current
way of grub_util_biosdisk_get_grub_dev just can't work.
So I use blkid to get the UUID of the device and then a new nested
function to find out the grub device like search does.
I think this is with intent from the kernel that it just returns 0's.
Maybe it just can't distinguish between a device mapper setup which goes
over multiple partitions or harddisks of different size not from one
which goes only over complete harddisks with same size like in dmraid
Hm but even if, I think it wouldn't help in case of RAID != 1. Sector
count could be > then last sector of one disk or not?
--
Felix Zielcke
Proud Debian Maintainer
[-- Attachment #2: find_by_uuid.patch --]
[-- Type: text/x-patch, Size: 3543 bytes --]
2009-07-26 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c: Include <grub/file.h>.
(grub_util_biosdisk_get_grub_dev): Use new nested function
find_partition_by_uuid in the case that the HD_GETGEO ioctl
returns 0 for the sectors count, to get the value of dos_part.
diff --git a/util/hostdisk.c b/util/hostdisk.c
index 5842698..843bfb4 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>
@@ -925,7 +926,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;
@@ -975,7 +976,46 @@ 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);
+ if (strchr (p, ','))
+ grub_util_error ("BSD partitions not yet supported");
+ 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)
@@ -1005,28 +1045,61 @@ 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);
}
+ else
+ {
+ 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);
+ }
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] 17+ messages in thread* Re: [PATCH] use UUID to map system devices to grub devices
2009-07-26 14:05 [PATCH] use UUID to map system devices to grub devices Felix Zielcke
@ 2009-07-28 18:12 ` Robert Millan
2009-07-29 8:43 ` Felix Zielcke
0 siblings, 1 reply; 17+ messages in thread
From: Robert Millan @ 2009-07-28 18:12 UTC (permalink / raw)
To: The development of GRUB 2
On Sun, Jul 26, 2009 at 04:05:31PM +0200, Felix Zielcke wrote:
> As requested by Robert on IRC, this is a split from my dmraid patch.
> On dmraid devices HDIO_GETGEO returns 0 for all fields, so the current
> way of grub_util_biosdisk_get_grub_dev just can't work.
> So I use blkid to get the UUID of the device and then a new nested
> function to find out the grub device like search does.
>
> I think this is with intent from the kernel that it just returns 0's.
> Maybe it just can't distinguish between a device mapper setup which goes
> over multiple partitions or harddisks of different size not from one
> which goes only over complete harddisks with same size like in dmraid
> Hm but even if, I think it wouldn't help in case of RAID != 1. Sector
> count could be > then last sector of one disk or not?
I keep thinking this is an overkill solution. We should to discuss more about
what's the problem we need to fix, and only ressort to this if we have no
other choice.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-07-28 18:12 ` Robert Millan
@ 2009-07-29 8:43 ` Felix Zielcke
2009-07-31 16:05 ` Robert Millan
0 siblings, 1 reply; 17+ messages in thread
From: Felix Zielcke @ 2009-07-29 8:43 UTC (permalink / raw)
To: The development of GRUB 2
Am Dienstag, den 28.07.2009, 20:12 +0200 schrieb Robert Millan:
> On Sun, Jul 26, 2009 at 04:05:31PM +0200, Felix Zielcke wrote:
> > As requested by Robert on IRC, this is a split from my dmraid patch.
> > On dmraid devices HDIO_GETGEO returns 0 for all fields, so the current
> > way of grub_util_biosdisk_get_grub_dev just can't work.
> > So I use blkid to get the UUID of the device and then a new nested
> > function to find out the grub device like search does.
> >
> > I think this is with intent from the kernel that it just returns 0's.
> > Maybe it just can't distinguish between a device mapper setup which goes
> > over multiple partitions or harddisks of different size not from one
> > which goes only over complete harddisks with same size like in dmraid
> > Hm but even if, I think it wouldn't help in case of RAID != 1. Sector
> > count could be > then last sector of one disk or not?
>
> I keep thinking this is an overkill solution. We should to discuss more about
> what's the problem we need to fix, and only ressort to this if we have no
> other choice.
>
The problem is how do we map a device file to a grub device.
Especially BSD partitions which only have numbers under Linux?
I don't know how the devices are called under BSD.
--
Felix Zielcke
Proud Debian Maintainer
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-07-29 8:43 ` Felix Zielcke
@ 2009-07-31 16:05 ` Robert Millan
2009-07-31 16:26 ` Felix Zielcke
0 siblings, 1 reply; 17+ messages in thread
From: Robert Millan @ 2009-07-31 16:05 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jul 29, 2009 at 10:43:23AM +0200, Felix Zielcke wrote:
> Am Dienstag, den 28.07.2009, 20:12 +0200 schrieb Robert Millan:
> > On Sun, Jul 26, 2009 at 04:05:31PM +0200, Felix Zielcke wrote:
> > > As requested by Robert on IRC, this is a split from my dmraid patch.
> > > On dmraid devices HDIO_GETGEO returns 0 for all fields, so the current
> > > way of grub_util_biosdisk_get_grub_dev just can't work.
> > > So I use blkid to get the UUID of the device and then a new nested
> > > function to find out the grub device like search does.
> > >
> > > I think this is with intent from the kernel that it just returns 0's.
> > > Maybe it just can't distinguish between a device mapper setup which goes
> > > over multiple partitions or harddisks of different size not from one
> > > which goes only over complete harddisks with same size like in dmraid
> > > Hm but even if, I think it wouldn't help in case of RAID != 1. Sector
> > > count could be > then last sector of one disk or not?
> >
> > I keep thinking this is an overkill solution. We should to discuss more about
> > what's the problem we need to fix, and only ressort to this if we have no
> > other choice.
> >
>
> The problem is how do we map a device file to a grub device.
> Especially BSD partitions which only have numbers under Linux?
> I don't know how the devices are called under BSD.
What does grub device mean in this context? If we're strictly in util/ land,
any arbitrary map will do as long as it's consistent.
If we're in both places, we already avoid making assumptions that there will
be consistency between them, so we don't need to make them now.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-07-31 16:05 ` Robert Millan
@ 2009-07-31 16:26 ` Felix Zielcke
2009-08-04 21:19 ` Robert Millan
0 siblings, 1 reply; 17+ messages in thread
From: Felix Zielcke @ 2009-07-31 16:26 UTC (permalink / raw)
To: The development of GRUB 2
Am Freitag, den 31.07.2009, 18:05 +0200 schrieb Robert Millan:
> On Wed, Jul 29, 2009 at 10:43:23AM +0200, Felix Zielcke wrote:
> > Am Dienstag, den 28.07.2009, 20:12 +0200 schrieb Robert Millan:
> > > On Sun, Jul 26, 2009 at 04:05:31PM +0200, Felix Zielcke wrote:
> > > > As requested by Robert on IRC, this is a split from my dmraid patch.
> > > > On dmraid devices HDIO_GETGEO returns 0 for all fields, so the current
> > > > way of grub_util_biosdisk_get_grub_dev just can't work.
> > > > So I use blkid to get the UUID of the device and then a new nested
> > > > function to find out the grub device like search does.
> > > >
> > > > I think this is with intent from the kernel that it just returns 0's.
> > > > Maybe it just can't distinguish between a device mapper setup which goes
> > > > over multiple partitions or harddisks of different size not from one
> > > > which goes only over complete harddisks with same size like in dmraid
> > > > Hm but even if, I think it wouldn't help in case of RAID != 1. Sector
> > > > count could be > then last sector of one disk or not?
> > >
> > > I keep thinking this is an overkill solution. We should to discuss more about
> > > what's the problem we need to fix, and only ressort to this if we have no
> > > other choice.
> > >
> >
> > The problem is how do we map a device file to a grub device.
> > Especially BSD partitions which only have numbers under Linux?
> > I don't know how the devices are called under BSD.
>
> What does grub device mean in this context? If we're strictly in util/ land,
> any arbitrary map will do as long as it's consistent.
> If we're in both places, we already avoid making assumptions that there will
> be consistency between them, so we don't need to make them now.
If we'd do an arbitrary mapping then `grub-probe -t drive' would show
the wrong grub device.
But except from this I think that would be okay.
--
Felix Zielcke
Proud Debian Maintainer
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-07-31 16:26 ` Felix Zielcke
@ 2009-08-04 21:19 ` Robert Millan
2009-08-05 6:18 ` Felix Zielcke
0 siblings, 1 reply; 17+ messages in thread
From: Robert Millan @ 2009-08-04 21:19 UTC (permalink / raw)
To: The development of GRUB 2
On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
>
> If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> the wrong grub device.
> But except from this I think that would be okay.
We can never garantee that `grub-probe -t drive' will show the "right" drive,
at least on i386-pc, because we don't know how is BIOS going to order them.
Maybe Linux order depends on a race, and is different every time! This
actually happens with some devices.
So the best we can do is to avoid reliing on it entirely, by using UUIDs in
the upper layer. We don't need to use UUIDs here, because they're already
being used to find the right filesystem when we boot.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-04 21:19 ` Robert Millan
@ 2009-08-05 6:18 ` Felix Zielcke
2009-08-05 10:50 ` Vladimir 'phcoder' Serbinenko
2009-08-07 11:27 ` Robert Millan
0 siblings, 2 replies; 17+ messages in thread
From: Felix Zielcke @ 2009-08-05 6:18 UTC (permalink / raw)
To: The development of GRUB 2
Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:
> On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
> >
> > If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> > the wrong grub device.
> > But except from this I think that would be okay.
>
> We can never garantee that `grub-probe -t drive' will show the "right" drive,
> at least on i386-pc, because we don't know how is BIOS going to order them.
Yes drive not, but the partition.
> Maybe Linux order depends on a race, and is different every time! This
> actually happens with some devices.
>
> So the best we can do is to avoid reliing on it entirely, by using UUIDs in
> the upper layer. We don't need to use UUIDs here, because they're already
> being used to find the right filesystem when we boot.
>
Unfortunately we don't have UUID support on every filesystem we support
like JFS. But I think it's not that commonly used.
If we assume that on multipath and dmraid devices there are no BSD
partitions we could just use the partition number in the device
filename.
Then we don't need to use UUIDs there.
Vladimir said FreeBSD doestn't support multipath.
--
Felix Zielcke
Proud Debian Maintainer
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-05 6:18 ` Felix Zielcke
@ 2009-08-05 10:50 ` Vladimir 'phcoder' Serbinenko
2009-08-05 11:01 ` Felix Zielcke
2009-08-07 11:27 ` Robert Millan
1 sibling, 1 reply; 17+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-08-05 10:50 UTC (permalink / raw)
To: The development of GRUB 2
> Vladimir said FreeBSD doestn't support multipath.
Unless I mistyped I said exactly the opposite:
http://www.freebsd.org/cgi/man.cgi?query=geom_fox&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html
>
>
> --
> Felix Zielcke
> Proud Debian Maintainer
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-05 6:18 ` Felix Zielcke
2009-08-05 10:50 ` Vladimir 'phcoder' Serbinenko
@ 2009-08-07 11:27 ` Robert Millan
2009-08-07 14:29 ` Felix Zielcke
1 sibling, 1 reply; 17+ messages in thread
From: Robert Millan @ 2009-08-07 11:27 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Aug 05, 2009 at 08:18:29AM +0200, Felix Zielcke wrote:
> Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:
> > On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
> > >
> > > If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> > > the wrong grub device.
> > > But except from this I think that would be okay.
> >
> > We can never garantee that `grub-probe -t drive' will show the "right" drive,
> > at least on i386-pc, because we don't know how is BIOS going to order them.
>
> Yes drive not, but the partition.
It's true, but we don't really make the distinction. UUID search will find
a filesystem, which is in a partition (usually), and doesn't rely on partitions
being reliable.
That's fortunate! It means we don't have to commit to partition numbers being
reliable, even if they are right now.
Because of this (unless I missed something), at the end of the day the
unreliability issue you described doesn't translate into any real problem
for us. It just adds more to a problem we already solved.
> Unfortunately we don't have UUID support on every filesystem we support
> like JFS. But I think it's not that commonly used.
Adding UUID support to new filesystems is very easy. I did the first ones
with just 5-10 minutes of research and a few lines of coding.
Would you like to do JFS ?
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-07 11:27 ` Robert Millan
@ 2009-08-07 14:29 ` Felix Zielcke
2009-08-07 19:22 ` Robert Millan
0 siblings, 1 reply; 17+ messages in thread
From: Felix Zielcke @ 2009-08-07 14:29 UTC (permalink / raw)
To: The development of GRUB 2
Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:
> On Wed, Aug 05, 2009 at 08:18:29AM +0200, Felix Zielcke wrote:
> > Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:
> > > On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
> > > >
> > > > If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> > > > the wrong grub device.
> > > > But except from this I think that would be okay.
> > >
> > > We can never garantee that `grub-probe -t drive' will show the "right" drive,
> > > at least on i386-pc, because we don't know how is BIOS going to order them.
> >
> > Yes drive not, but the partition.
>
> It's true, but we don't really make the distinction. UUID search will find
> a filesystem, which is in a partition (usually), and doesn't rely on partitions
> being reliable.
>
> That's fortunate! It means we don't have to commit to partition numbers being
> reliable, even if they are right now.
>
> Because of this (unless I missed something), at the end of the day the
> unreliability issue you described doesn't translate into any real problem
> for us. It just adds more to a problem we already solved.
>
> > Unfortunately we don't have UUID support on every filesystem we support
> > like JFS. But I think it's not that commonly used.
>
> Adding UUID support to new filesystems is very easy. I did the first ones
> with just 5-10 minutes of research and a few lines of coding.
>
> Would you like to do JFS ?
I did it now for JFS.
I tried it now out with dos_part set to p + 2 with my find_by_uuid patch
and now I get a `no such partition' error on my dmraid device.
So we can't use an arbitary mapping in grub_util_biosdisk_get_grub_dev
--
Felix Zielcke
Proud Debian Maintainer
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-07 14:29 ` Felix Zielcke
@ 2009-08-07 19:22 ` Robert Millan
2009-08-08 5:13 ` Felix Zielcke
0 siblings, 1 reply; 17+ messages in thread
From: Robert Millan @ 2009-08-07 19:22 UTC (permalink / raw)
To: The development of GRUB 2
On Fri, Aug 07, 2009 at 04:29:00PM +0200, Felix Zielcke wrote:
> Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:
> > On Wed, Aug 05, 2009 at 08:18:29AM +0200, Felix Zielcke wrote:
> > > Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:
> > > > On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
> > > > >
> > > > > If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> > > > > the wrong grub device.
> > > > > But except from this I think that would be okay.
> > > >
> > > > We can never garantee that `grub-probe -t drive' will show the "right" drive,
> > > > at least on i386-pc, because we don't know how is BIOS going to order them.
> > >
> > > Yes drive not, but the partition.
> >
> > It's true, but we don't really make the distinction. UUID search will find
> > a filesystem, which is in a partition (usually), and doesn't rely on partitions
> > being reliable.
> >
> > That's fortunate! It means we don't have to commit to partition numbers being
> > reliable, even if they are right now.
> >
> > Because of this (unless I missed something), at the end of the day the
> > unreliability issue you described doesn't translate into any real problem
> > for us. It just adds more to a problem we already solved.
> >
> > > Unfortunately we don't have UUID support on every filesystem we support
> > > like JFS. But I think it's not that commonly used.
> >
> > Adding UUID support to new filesystems is very easy. I did the first ones
> > with just 5-10 minutes of research and a few lines of coding.
> >
> > Would you like to do JFS ?
>
> I did it now for JFS.
>
> I tried it now out with dos_part set to p + 2 with my find_by_uuid patch
> and now I get a `no such partition' error on my dmraid device.
> So we can't use an arbitary mapping in grub_util_biosdisk_get_grub_dev
Why not?
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-07 19:22 ` Robert Millan
@ 2009-08-08 5:13 ` Felix Zielcke
2009-08-10 11:31 ` Robert Millan
0 siblings, 1 reply; 17+ messages in thread
From: Felix Zielcke @ 2009-08-08 5:13 UTC (permalink / raw)
To: The development of GRUB 2
Am Freitag, den 07.08.2009, 21:22 +0200 schrieb Robert Millan:
> On Fri, Aug 07, 2009 at 04:29:00PM +0200, Felix Zielcke wrote:
> > Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:
> > > On Wed, Aug 05, 2009 at 08:18:29AM +0200, Felix Zielcke wrote:
> > > > Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:
> > > > > On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
> > > > > >
> > > > > > If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> > > > > > the wrong grub device.
> > > > > > But except from this I think that would be okay.
> > > > >
> > > > > We can never garantee that `grub-probe -t drive' will show the "right" drive,
> > > > > at least on i386-pc, because we don't know how is BIOS going to order them.
> > > >
> > > > Yes drive not, but the partition.
> > >
> > > It's true, but we don't really make the distinction. UUID search will find
> > > a filesystem, which is in a partition (usually), and doesn't rely on partitions
> > > being reliable.
> > >
> > > That's fortunate! It means we don't have to commit to partition numbers being
> > > reliable, even if they are right now.
> > >
> > > Because of this (unless I missed something), at the end of the day the
> > > unreliability issue you described doesn't translate into any real problem
> > > for us. It just adds more to a problem we already solved.
> > >
> > > > Unfortunately we don't have UUID support on every filesystem we support
> > > > like JFS. But I think it's not that commonly used.
> > >
> > > Adding UUID support to new filesystems is very easy. I did the first ones
> > > with just 5-10 minutes of research and a few lines of coding.
> > >
> > > Would you like to do JFS ?
> >
> > I did it now for JFS.
> >
> > I tried it now out with dos_part set to p + 2 with my find_by_uuid patch
> > and now I get a `no such partition' error on my dmraid device.
> > So we can't use an arbitary mapping in grub_util_biosdisk_get_grub_dev
>
> Why not?
well then we would need to change the partition table parsing code to
use the same arbitary mapping for GRUB_UTIL && LINUX then
grub_util_biosdisk_get_grub_dev and I think that's not really a proper
solution.
--
Felix Zielcke
Proud Debian Maintainer
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-08 5:13 ` Felix Zielcke
@ 2009-08-10 11:31 ` Robert Millan
2009-08-10 12:46 ` Felix Zielcke
0 siblings, 1 reply; 17+ messages in thread
From: Robert Millan @ 2009-08-10 11:31 UTC (permalink / raw)
To: The development of GRUB 2
On Sat, Aug 08, 2009 at 07:13:20AM +0200, Felix Zielcke wrote:
> Am Freitag, den 07.08.2009, 21:22 +0200 schrieb Robert Millan:
> > On Fri, Aug 07, 2009 at 04:29:00PM +0200, Felix Zielcke wrote:
> > > Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:
> > > > On Wed, Aug 05, 2009 at 08:18:29AM +0200, Felix Zielcke wrote:
> > > > > Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:
> > > > > > On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
> > > > > > >
> > > > > > > If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> > > > > > > the wrong grub device.
> > > > > > > But except from this I think that would be okay.
> > > > > >
> > > > > > We can never garantee that `grub-probe -t drive' will show the "right" drive,
> > > > > > at least on i386-pc, because we don't know how is BIOS going to order them.
> > > > >
> > > > > Yes drive not, but the partition.
> > > >
> > > > It's true, but we don't really make the distinction. UUID search will find
> > > > a filesystem, which is in a partition (usually), and doesn't rely on partitions
> > > > being reliable.
> > > >
> > > > That's fortunate! It means we don't have to commit to partition numbers being
> > > > reliable, even if they are right now.
> > > >
> > > > Because of this (unless I missed something), at the end of the day the
> > > > unreliability issue you described doesn't translate into any real problem
> > > > for us. It just adds more to a problem we already solved.
> > > >
> > > > > Unfortunately we don't have UUID support on every filesystem we support
> > > > > like JFS. But I think it's not that commonly used.
> > > >
> > > > Adding UUID support to new filesystems is very easy. I did the first ones
> > > > with just 5-10 minutes of research and a few lines of coding.
> > > >
> > > > Would you like to do JFS ?
> > >
> > > I did it now for JFS.
> > >
> > > I tried it now out with dos_part set to p + 2 with my find_by_uuid patch
> > > and now I get a `no such partition' error on my dmraid device.
> > > So we can't use an arbitary mapping in grub_util_biosdisk_get_grub_dev
> >
> > Why not?
>
> well then we would need to change the partition table parsing code to
> use the same arbitary mapping for GRUB_UTIL && LINUX then
> grub_util_biosdisk_get_grub_dev and I think that's not really a proper
> solution.
Why? In that specific situation, it seems:
- We're unable to obtain partition numbers reliably
- It doesn't matter, because the upper layer will sort that out
Though, it'd be much better if we could obtain this information from Linux.
Did you figure out if the behaviour of that ioctl is a bug or is intentional?
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-10 11:31 ` Robert Millan
@ 2009-08-10 12:46 ` Felix Zielcke
2009-08-10 12:58 ` Felix Zielcke
0 siblings, 1 reply; 17+ messages in thread
From: Felix Zielcke @ 2009-08-10 12:46 UTC (permalink / raw)
To: The development of GRUB 2
Am Montag, den 10.08.2009, 13:31 +0200 schrieb Robert Millan:
> On Sat, Aug 08, 2009 at 07:13:20AM +0200, Felix Zielcke wrote:
> > Am Freitag, den 07.08.2009, 21:22 +0200 schrieb Robert Millan:
> > > On Fri, Aug 07, 2009 at 04:29:00PM +0200, Felix Zielcke wrote:
> > > > Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:
> > > > > On Wed, Aug 05, 2009 at 08:18:29AM +0200, Felix Zielcke wrote:
> > > > > > Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:
> > > > > > > On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
> > > > > > > >
> > > > > > > > If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> > > > > > > > the wrong grub device.
> > > > > > > > But except from this I think that would be okay.
> > > > > > >
> > > > > > > We can never garantee that `grub-probe -t drive' will show the "right" drive,
> > > > > > > at least on i386-pc, because we don't know how is BIOS going to order them.
> > > > > >
> > > > > > Yes drive not, but the partition.
> > > > >
> > > > > It's true, but we don't really make the distinction. UUID search will find
> > > > > a filesystem, which is in a partition (usually), and doesn't rely on partitions
> > > > > being reliable.
> > > > >
> > > > > That's fortunate! It means we don't have to commit to partition numbers being
> > > > > reliable, even if they are right now.
> > > > >
> > > > > Because of this (unless I missed something), at the end of the day the
> > > > > unreliability issue you described doesn't translate into any real problem
> > > > > for us. It just adds more to a problem we already solved.
> > > > >
> > > > > > Unfortunately we don't have UUID support on every filesystem we support
> > > > > > like JFS. But I think it's not that commonly used.
> > > > >
> > > > > Adding UUID support to new filesystems is very easy. I did the first ones
> > > > > with just 5-10 minutes of research and a few lines of coding.
> > > > >
> > > > > Would you like to do JFS ?
> > > >
> > > > I did it now for JFS.
> > > >
> > > > I tried it now out with dos_part set to p + 2 with my find_by_uuid patch
> > > > and now I get a `no such partition' error on my dmraid device.
> > > > So we can't use an arbitary mapping in grub_util_biosdisk_get_grub_dev
> > >
> > > Why not?
> >
> > well then we would need to change the partition table parsing code to
> > use the same arbitary mapping for GRUB_UTIL && LINUX then
> > grub_util_biosdisk_get_grub_dev and I think that's not really a proper
> > solution.
>
> Why? In that specific situation, it seems:
>
> - We're unable to obtain partition numbers reliably
>
> - It doesn't matter, because the upper layer will sort that out
Well with the current design of util/hostdisk.c it doestn't work.
I don't know how we can make an arbitary mapping work.
> Though, it'd be much better if we could obtain this information from Linux.
> Did you figure out if the behaviour of that ioctl is a bug or is intentional?
Probable intentional, because device-mapper is also used for LVM for
which HDIO_GETGEO really doestn't make sense.
Someone sent a patch to implement it for device-mapper in 2006 to LKML
[0] but it wasn't accepted.
Now I noticed Andrew Morton said `block_device_operations now has a
standalone `getgeo' method.', which doestn't say me anything if this is
something we can use or if this is purely internal for the kernel.
[0] http://lkml.indiana.edu/hypermail/linux/kernel/0602.1/index.html#0729
--
Felix Zielcke
Proud Debian Maintainer
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-10 12:46 ` Felix Zielcke
@ 2009-08-10 12:58 ` Felix Zielcke
2009-08-10 15:29 ` Robert Millan
0 siblings, 1 reply; 17+ messages in thread
From: Felix Zielcke @ 2009-08-10 12:58 UTC (permalink / raw)
To: The development of GRUB 2
Am Montag, den 10.08.2009, 14:46 +0200 schrieb Felix Zielcke:
> Am Montag, den 10.08.2009, 13:31 +0200 schrieb Robert Millan:
> > On Sat, Aug 08, 2009 at 07:13:20AM +0200, Felix Zielcke wrote:
> > > Am Freitag, den 07.08.2009, 21:22 +0200 schrieb Robert Millan:
> > > > On Fri, Aug 07, 2009 at 04:29:00PM +0200, Felix Zielcke wrote:
> > > > > Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:
> > > > > > On Wed, Aug 05, 2009 at 08:18:29AM +0200, Felix Zielcke wrote:
> > > > > > > Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:
> > > > > > > > On Fri, Jul 31, 2009 at 06:26:51PM +0200, Felix Zielcke wrote:
> > > > > > > > >
> > > > > > > > > If we'd do an arbitrary mapping then `grub-probe -t drive' would show
> > > > > > > > > the wrong grub device.
> > > > > > > > > But except from this I think that would be okay.
> > > > > > > >
> > > > > > > > We can never garantee that `grub-probe -t drive' will show the "right" drive,
> > > > > > > > at least on i386-pc, because we don't know how is BIOS going to order them.
> > > > > > >
> > > > > > > Yes drive not, but the partition.
> > > > > >
> > > > > > It's true, but we don't really make the distinction. UUID search will find
> > > > > > a filesystem, which is in a partition (usually), and doesn't rely on partitions
> > > > > > being reliable.
> > > > > >
> > > > > > That's fortunate! It means we don't have to commit to partition numbers being
> > > > > > reliable, even if they are right now.
> > > > > >
> > > > > > Because of this (unless I missed something), at the end of the day the
> > > > > > unreliability issue you described doesn't translate into any real problem
> > > > > > for us. It just adds more to a problem we already solved.
> > > > > >
> > > > > > > Unfortunately we don't have UUID support on every filesystem we support
> > > > > > > like JFS. But I think it's not that commonly used.
> > > > > >
> > > > > > Adding UUID support to new filesystems is very easy. I did the first ones
> > > > > > with just 5-10 minutes of research and a few lines of coding.
> > > > > >
> > > > > > Would you like to do JFS ?
> > > > >
> > > > > I did it now for JFS.
> > > > >
> > > > > I tried it now out with dos_part set to p + 2 with my find_by_uuid patch
> > > > > and now I get a `no such partition' error on my dmraid device.
> > > > > So we can't use an arbitary mapping in grub_util_biosdisk_get_grub_dev
> > > >
> > > > Why not?
> > >
> > > well then we would need to change the partition table parsing code to
> > > use the same arbitary mapping for GRUB_UTIL && LINUX then
> > > grub_util_biosdisk_get_grub_dev and I think that's not really a proper
> > > solution.
> >
> > Why? In that specific situation, it seems:
> >
> > - We're unable to obtain partition numbers reliably
> >
> > - It doesn't matter, because the upper layer will sort that out
>
> Well with the current design of util/hostdisk.c it doestn't work.
> I don't know how we can make an arbitary mapping work.
>
> > Though, it'd be much better if we could obtain this information from Linux.
> > Did you figure out if the behaviour of that ioctl is a bug or is intentional?
>
> Probable intentional, because device-mapper is also used for LVM for
> which HDIO_GETGEO really doestn't make sense.
> Someone sent a patch to implement it for device-mapper in 2006 to LKML
> [0] but it wasn't accepted.
> Now I noticed Andrew Morton said `block_device_operations now has a
> standalone `getgeo' method.', which doestn't say me anything if this is
> something we can use or if this is purely internal for the kernel.
>
> [0] http://lkml.indiana.edu/hypermail/linux/kernel/0602.1/index.html#0729
>
Oh and it's limited to 2 TiB on 32bit systems, so I think it would be
good if we find an alternative to it.
Western Digital and Seagate sell now 2 TB disks.
--
Felix Zielcke
Proud Debian Maintainer
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] use UUID to map system devices to grub devices
2009-08-10 12:58 ` Felix Zielcke
@ 2009-08-10 15:29 ` Robert Millan
0 siblings, 0 replies; 17+ messages in thread
From: Robert Millan @ 2009-08-10 15:29 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Aug 10, 2009 at 02:58:39PM +0200, Felix Zielcke wrote:
>
> Oh and it's limited to 2 TiB on 32bit systems, so I think it would be
> good if we find an alternative to it.
> Western Digital and Seagate sell now 2 TB disks.
Does BLKGETSIZE64 help?
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2009-08-10 15:30 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-26 14:05 [PATCH] use UUID to map system devices to grub devices Felix Zielcke
2009-07-28 18:12 ` Robert Millan
2009-07-29 8:43 ` Felix Zielcke
2009-07-31 16:05 ` Robert Millan
2009-07-31 16:26 ` Felix Zielcke
2009-08-04 21:19 ` Robert Millan
2009-08-05 6:18 ` Felix Zielcke
2009-08-05 10:50 ` Vladimir 'phcoder' Serbinenko
2009-08-05 11:01 ` Felix Zielcke
2009-08-07 11:27 ` Robert Millan
2009-08-07 14:29 ` Felix Zielcke
2009-08-07 19:22 ` Robert Millan
2009-08-08 5:13 ` Felix Zielcke
2009-08-10 11:31 ` Robert Millan
2009-08-10 12:46 ` Felix Zielcke
2009-08-10 12:58 ` Felix Zielcke
2009-08-10 15:29 ` Robert Millan
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.