Skip to contentSkip to conversation

use UUID to map system devices to grub devices

PATCH In review Felix Zielcke 3 participants 17 messages Jul 26, 2009 – Aug 10, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use UUID to map system devices to grub devices

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?

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer

2009-07-26 Felix Zielcke <[email protected]>

* 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.

util/hostdisk.c +86 -13
index 5842698..843bfb4 100644
@@ -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);
   }
 
#1 lore raw
Quoted 6 lines · Felix Zielcke

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.

Quoted 6 lines

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.

Signature · 5 lines
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."
#2 lore raw

Am Dienstag, den 28.07.2009, 20:12 +0200 schrieb Robert Millan:

Quoted 14 lines · Felix Zielcke
Quoted 6 lines

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.

Quoted 6 lines

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?

Quoted 4 lines

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.

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#3 lore raw
Quoted 15 lines · Felix Zielcke

Am Dienstag, den 28.07.2009, 20:12 +0200 schrieb Robert Millan:

Quoted 14 lines · Felix Zielcke
Quoted 12 lines

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?

Quoted 8 lines
Quoted 4 lines

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.

Signature · 5 lines
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."
#4 lore raw

Am Freitag, den 31.07.2009, 18:05 +0200 schrieb Robert Millan:

Quoted 25 lines · Felix Zielcke
Quoted 15 lines

Am Dienstag, den 28.07.2009, 20:12 +0200 schrieb Robert Millan:

Quoted 14 lines · Felix Zielcke
Quoted 12 lines

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?

Quoted 8 lines
Quoted 4 lines

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.

Quoted 5 lines

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.

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#5 lore raw
Quoted 4 lines · Felix Zielcke

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.

Signature · 5 lines
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."
#6 lore raw

Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:

Quoted 8 lines · Felix Zielcke
Quoted 4 lines

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.

Quoted 7 lines

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.

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#7 lore raw
Quoted 1 line

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

Quoted 13 lines

--
Felix Zielcke
Proud Debian Maintainer

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
#8 lore raw

Am Mittwoch, den 05.08.2009, 12:50 +0200 schrieb Vladimir 'phcoder' Serbinenko:

Quoted 3 lines
Quoted 1 line

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

Oh sorry.

But then I really don't know what we can do else then my already sent patch.
As long as we want to have `grub-probe -t drive' to show the right partition even with BSD ones, we have to map the linux numbers to grub partitions.
I still think I don't need to bother to write to LKML to fix HDIO_GETGEO for device-mapper. It's a low level interface, which is also used for LVM where HDIO_GETGEO just doestn't make any sense.
So I think UUIDs are the only other choice to map linux partition numberts to GRUB partitions.

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#9 lore raw
In reply to Felix Zielcke
Quoted 11 lines · Felix Zielcke

Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:

Quoted 8 lines · Felix Zielcke
Quoted 4 lines

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.

Quoted 2 lines

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 ?

Signature · 5 lines
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."
#10 lore raw

Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:

Quoted 24 lines · Felix Zielcke
Quoted 11 lines

Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:

Quoted 8 lines · Felix Zielcke
Quoted 4 lines

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.

Quoted 7 lines
Quoted 2 lines

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

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#11 lore raw
Quoted 31 lines · Felix Zielcke

Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:

Quoted 30 lines · Felix Zielcke
Quoted 11 lines

Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:

Quoted 8 lines · Felix Zielcke
Quoted 4 lines

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.

Quoted 2 lines

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.

Quoted 7 lines
Quoted 1 line

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?

Signature · 5 lines
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."
#12 lore raw

Am Freitag, den 07.08.2009, 21:22 +0200 schrieb Robert Millan:

Quoted 34 lines · Felix Zielcke
Quoted 33 lines

Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:

Quoted 31 lines · Felix Zielcke
Quoted 11 lines

Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:

Quoted 8 lines · Felix Zielcke
Quoted 4 lines

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.

Quoted 2 lines

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 ?

Quoted 7 lines
Quoted 5 lines

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.

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#13 lore raw
Quoted 41 lines · Felix Zielcke

Am Freitag, den 07.08.2009, 21:22 +0200 schrieb Robert Millan:

Quoted 40 lines · Felix Zielcke
Quoted 38 lines

Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:

Quoted 24 lines · Felix Zielcke
Quoted 11 lines

Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:

Quoted 8 lines · Felix Zielcke
Quoted 4 lines

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.

Quoted 7 lines
Quoted 2 lines

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

Quoted 6 lines
Quoted 1 line

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?

Signature · 5 lines
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."
#14 lore raw

Am Montag, den 10.08.2009, 13:31 +0200 schrieb Robert Millan:

Quoted 49 lines · Felix Zielcke
Quoted 41 lines

Am Freitag, den 07.08.2009, 21:22 +0200 schrieb Robert Millan:

Quoted 40 lines · Felix Zielcke
Quoted 38 lines

Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:

Quoted 24 lines · Felix Zielcke
Quoted 11 lines

Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:

Quoted 8 lines · Felix Zielcke
Quoted 4 lines

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.

Quoted 7 lines
Quoted 2 lines

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

Quoted 6 lines
Quoted 1 line

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.

Quoted 5 lines

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.

Quoted 2 lines

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

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#15 lore raw

Am Montag, den 10.08.2009, 14:46 +0200 schrieb Felix Zielcke:

Quoted 70 lines

Am Montag, den 10.08.2009, 13:31 +0200 schrieb Robert Millan:

Quoted 49 lines · Felix Zielcke
Quoted 41 lines

Am Freitag, den 07.08.2009, 21:22 +0200 schrieb Robert Millan:

Quoted 40 lines · Felix Zielcke
Quoted 38 lines

Am Freitag, den 07.08.2009, 13:27 +0200 schrieb Robert Millan:

Quoted 24 lines · Felix Zielcke
Quoted 11 lines

Am Dienstag, den 04.08.2009, 23:19 +0200 schrieb Robert Millan:

Quoted 8 lines · Felix Zielcke
Quoted 4 lines

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.

Quoted 7 lines
Quoted 2 lines

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

Quoted 6 lines
Quoted 1 line

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.

Quoted 5 lines

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.

Quoted 2 lines

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.

Quoted 2 lines

[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.

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#16 lore raw
Quoted 4 lines · Felix Zielcke

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?

Signature · 5 lines
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."