Skip to contentSkip to conversation

PV-GRUB - Does not read partition-less disk

DISCUSSION Bastian Blank 3 participants 14 messages Sep 11, 2008 – Sep 17, 2008

lore
Share & tools
lore
#0 lore raw

Hi folks

PV-GRUB built from Xen 3.3.0 is not able to read from devices without a partition table:

| grubdom> root (hd0)
| Filesystem type unknown, using whole disk

Part of the config:
| disk = [ "phy:vg0_sledgehammer/servext_root,xvda,w" ]

Device:

| # file -s /dev/vg0_sledgehammer/servext_root       
| /dev/vg0_sledgehammer/servext_root: symbolic link to `/dev/mapper/vg0_sledgehammer-servext_root'
| # file -s /dev/mapper/vg0_sledgehammer-servext_root 
| /dev/mapper/vg0_sledgehammer-servext_root: Linux rev 1.0 ext3 filesystem data

Bastian

Signature · 2 lines
You can't evaluate a man by logic alone.
		-- McCoy, "I, Mudd", stardate 4513.3
#1 lore raw

Hello Bastian,

In this case, are you using the root partition for all block device or is this partitioned? If you are using all block device (the logical volume) to root disk, you need to set in your conffile it to 'xvda1'. Case you are using a logical volume partitioned and the root disk is the first partition, the right is:
| grubdom> root (hd0,0)

Best Regards,

Quoted 28 lines · Bastian Blank

Hi folks

PV-GRUB built from Xen 3.3.0 is not able to read from devices without a partition table:

| grubdom> root (hd0)
| Filesystem type unknown, using whole disk

Part of the config:
| disk = [ "phy:vg0_sledgehammer/servext_root,xvda,w" ]

Device:

| # file -s /dev/vg0_sledgehammer/servext_root
| /dev/vg0_sledgehammer/servext_root: symbolic link to `/dev/mapper/vg0_sledgehammer-servext_root'
| # file -s /dev/mapper/vg0_sledgehammer-servext_root
| /dev/mapper/vg0_sledgehammer-servext_root: Linux rev 1.0 ext3 filesystem data

Bastian

--
You can't evaluate a man by logic alone.

               -- McCoy, "I, Mudd", stardate 4513.3

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 1 line
Marco Sinhoreli
#2 lore raw
Quoted 2 lines · Marco Sinhoreli

In this case, are you using the root partition for all block device or is this partitioned?

Äh, this is one device with a filesystem on it.

Quoted 2 lines

If you are using all block device (the logical
volume) to root disk, you need to set in your conffile it to 'xvda1'.

Since when does this set more then the name flag in xenstore and emulate a partition table for use by the system? And no, this does not work either.

Bastian

Signature · 2 lines
Violence in reality is quite different from theory.
		-- Spock, "The Cloud Minders", stardate 5818.4
#4 lore raw
Quoted 2 lines · Marco Sinhoreli

Look this example:
* /etc/xen/xmexample.pv-grub or xen-3.3.0/tools/examples/xmexample.pv-grub

hdaX is not supported by current kernels in the disk definition. And this does not work either. It still sees one disk (hd0) without a partition table and an unknown fs.

Bastian

Signature · 1 line
Warp 7 -- It's a law we can live with.
#5 lore raw

Do you have a system installed in this disk? Are you passing the path of menu.lst in your configuration?
extra = "(hd0,0)/boot/grub/menu.lst"

I used a Debian lenny as dom0 and domU and it is working fine to me. To partitioning the logical volume, I used the fdisk and, to access it, I used kpartx. After mapped the partitions in /dev/mapper/, I formated and I installed the system using debootstrap. I needed to edit some files like /etc/fstab, /boot/grub/menu.lst, /etc/securetty and /etc/inittab and to copy the kernel, and initrd.img and the modules into virtual machine partition.

Quoted 18 lines · Bastian Blank
Quoted 2 lines · Marco Sinhoreli

Look this example:
* /etc/xen/xmexample.pv-grub or xen-3.3.0/tools/examples/xmexample.pv-grub

hdaX is not supported by current kernels in the disk definition. And this does not work either. It still sees one disk (hd0) without a partition table and an unknown fs.

Bastian

--
Warp 7 -- It's a law we can live with.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 1 line
Marco Sinhoreli
#6 lore raw
Quoted 1 line · Marco Sinhoreli

Do you have a system installed in this disk?

Sure.

Quoted 3 lines

Are you passing the path
of menu.lst in your configuration?
extra = "(hd0,0)/boot/grub/menu.lst"

Yes. But even if not, "root (hd0)" should show that it can see the filesystem. And the fact that it falls back into the normal commandline and not the menu shows that it is not able to read the config.

Bastian

Signature · 1 line
Mind your own business, Spock.  I'm sick of your halfbreed interference.
#7 lore raw

My tests:

# grep '^disk' pvmtest
disk = [ 'phy:empirevg/lenny.pvm,xvda,w' ]
# xm create -c /etc/xen/pvmtest
| grubdom> root (hd0)
| Filesystem type unknown, using whole disk
|
| grubdom> root (hd0,0)
| Filesystem type is ext2fs, partition type 0x83
|
| grubdom> configfile (hd0,0)/boot/grub/menu.lst

After this the grub menu was opened.

# fdisk -l /dev/empirevg/lenny.pvm
| Disk /dev/empirevg/lenny.pvm: 10.7 GB, 10737418240 bytes
| 255 heads, 63 sectors/track, 1305 cylinders
| Units = cylinders of 16065 * 512 = 8225280 bytes
| Disk identifier: 0x50e94ad8
|
|                   Device Boot      Start         End      Blocks   Id  System
| /dev/empirevg/lenny.pvm1               1        1156     9285538+  83  Linux
| /dev/empirevg/lenny.pvm2            1157        1305     1196842+
82  Linux swap / Solaris
Quoted 18 lines · Bastian Blank
Quoted 1 line · Marco Sinhoreli

Do you have a system installed in this disk?

Sure.

Quoted 3 lines

Are you passing the path
of menu.lst in your configuration?
extra = "(hd0,0)/boot/grub/menu.lst"

Yes. But even if not, "root (hd0)" should show that it can see the filesystem. And the fact that it falls back into the normal commandline and not the menu shows that it is not able to read the config.

Bastian

--
Mind your own business, Spock. I'm sick of your halfbreed interference.

Signature · 1 line
Marco Sinhoreli
#8 lore raw
Quoted 4 lines · Marco Sinhoreli
| grubdom> root (hd0,0)
| Filesystem type is ext2fs, partition type 0x83
|
| grubdom> configfile (hd0,0)/boot/grub/menu.lst

So we are at the beginning. You have a partition table on the device, I don't.

Anyway, I found it. It is buried in the filesystem modules of grub in the mount hook. It checks for

| ((current_drive & 0x80) || (current_slice != 0))
|    && (current_slice != PC_SLICE_TYPE_EXT2FS)
|    && (current_slice != PC_SLICE_TYPE_LINUX_RAID)
|    && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_EXT2FS))
|    && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))

Which reads as:
- If device is a harddisk,
- or it is a slice with none matching type,
then abort.

It simply refuses to find filesystems on the whole disk. If I remove the current_disk check it is able to find the filesystem.

Bastian

Signature · 2 lines
To live is always desirable.
		-- Eleen the Capellan, "Friday's Child", stardate 3498.9
#9 lore raw
Quoted 2 lines · Bastian Blank, le Fri 12 Sep 2008 21:16:36 +0200, a écrit :

Anyway, I found it. It is buried in the filesystem modules of grub in the mount hook.

Cool, I currently don't have much time to spend on these :)

Quoted 7 lines

It checks for

| ((current_drive & 0x80) || (current_slice != 0))
|    && (current_slice != PC_SLICE_TYPE_EXT2FS)
|    && (current_slice != PC_SLICE_TYPE_LINUX_RAID)
|    && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_EXT2FS))
|    && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))
Quoted 7 lines

Which reads as:
- If device is a harddisk,
- or it is a slice with none matching type,
then abort.

It simply refuses to find filesystems on the whole disk. If I remove the current_disk check it is able to find the filesystem.

Uh, so that's an upstream bug, isn't it?

Samuel

#10 lore raw
Quoted 4 lines · Samuel Thibault
Quoted 2 lines · Bastian Blank, le Fri 12 Sep 2008 21:16:36 +0200, a écrit :

It simply refuses to find filesystems on the whole disk. If I remove the current_disk check it is able to find the filesystem.

Uh, so that's an upstream bug, isn't it?

Yes. Many PC BIOS and even the OpenPOWER OF refuses to boot from disks without a partition table, so I doubt that such a setup is used often on real machines.

Bastian

Signature · 2 lines
Men of peace usually are [brave].
		-- Spock, "The Savage Curtain", stardate 5906.5
#11 lore raw
Quoted 8 lines · Bastian Blank, le Fri 12 Sep 2008 21:54:00 +0200, a écrit :
Quoted 4 lines · Samuel Thibault
Quoted 2 lines · Bastian Blank, le Fri 12 Sep 2008 21:16:36 +0200, a écrit :

It simply refuses to find filesystems on the whole disk. If I remove the current_disk check it is able to find the filesystem.

Uh, so that's an upstream bug, isn't it?

Yes. Many PC BIOS and even the OpenPOWER OF refuses to boot from disks without a partition table,

You could still want to have grub load a kernel from a secondary drive.

Samuel

#12 lore raw
In reply to Samuel Thibault
Quoted 4 lines · Samuel Thibault
Quoted 2 lines · Bastian Blank, le Fri 12 Sep 2008 21:16:36 +0200, a écrit :

Anyway, I found it. It is buried in the filesystem modules of grub in the mount hook.

Cool, I currently don't have much time to spend on these :)

Patch.

Bastian

stubdom/grub.patches/50fs_fulldisk.diff new file +72 -0
diff -r 8abe082246d0 stubdom/grub.patches/50fs_fulldisk.diff
@@ -0,0 +1,72 @@
+diff -urN grub-0.97.orig/stage2/fsys_ext2fs.c grub-0.97/stage2/fsys_ext2fs.c
+--- grub-0.97.orig/stage2/fsys_ext2fs.c	2004-08-08 18:19:18.000000000 +0000
++++ grub-0.97/stage2/fsys_ext2fs.c	2008-09-16 19:31:15.000000000 +0000
+@@ -254,7 +254,7 @@
+ {
+   int retval = 1;
+ 
+-  if ((((current_drive & 0x80) || (current_slice != 0))
++  if ((((current_slice != 0))
+        && (current_slice != PC_SLICE_TYPE_EXT2FS)
+        && (current_slice != PC_SLICE_TYPE_LINUX_RAID)
+        && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_EXT2FS))
+diff -urN grub-0.97.orig/stage2/fsys_fat.c grub-0.97/stage2/fsys_fat.c
+--- grub-0.97.orig/stage2/fsys_fat.c	2005-03-15 16:52:00.000000000 +0000
++++ grub-0.97/stage2/fsys_fat.c	2008-09-16 19:31:26.000000000 +0000
+@@ -70,7 +70,7 @@
+   __u32 magic, first_fat;
+   
+   /* Check partition type for harddisk */
+-  if (((current_drive & 0x80) || (current_slice != 0))
++  if (((current_slice != 0))
+       && ! IS_PC_SLICE_TYPE_FAT (current_slice)
+       && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_MSDOS)))
+     return 0;
+diff -urN grub-0.97.orig/stage2/fsys_ffs.c grub-0.97/stage2/fsys_ffs.c
+--- grub-0.97.orig/stage2/fsys_ffs.c	2003-07-09 11:45:52.000000000 +0000
++++ grub-0.97/stage2/fsys_ffs.c	2008-09-16 19:31:32.000000000 +0000
+@@ -82,7 +82,7 @@
+ {
+   int retval = 1;
+ 
+-  if ((((current_drive & 0x80) || (current_slice != 0))
++  if ((((current_slice != 0))
+        && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_BSDFFS))
+       || part_length < (SBLOCK + (SBSIZE / DEV_BSIZE))
+       || !devread (SBLOCK, 0, SBSIZE, (char *) SUPERBLOCK)
+diff -urN grub-0.97.orig/stage2/fsys_minix.c grub-0.97/stage2/fsys_minix.c
+--- grub-0.97.orig/stage2/fsys_minix.c	2003-07-09 11:45:53.000000000 +0000
++++ grub-0.97/stage2/fsys_minix.c	2008-09-16 19:32:01.000000000 +0000
+@@ -160,7 +160,7 @@
+ int
+ minix_mount (void)
+ {
+-  if (((current_drive & 0x80) || current_slice != 0)
++  if ((current_slice != 0)
+       && ! IS_PC_SLICE_TYPE_MINIX (current_slice)
+       && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))
+     return 0;			/* The partition is not of MINIX type */
+diff -urN grub-0.97.orig/stage2/fsys_ufs2.c grub-0.97/stage2/fsys_ufs2.c
+--- grub-0.97.orig/stage2/fsys_ufs2.c	2004-06-19 12:17:52.000000000 +0000
++++ grub-0.97/stage2/fsys_ufs2.c	2008-09-16 19:32:32.000000000 +0000
+@@ -87,7 +87,7 @@
+   sblockloc = -1;
+   type = 0;
+   
+-  if (! (((current_drive & 0x80) || (current_slice != 0))
++  if (! (((current_slice != 0))
+ 	 && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_BSDFFS)))
+     {
+       for (i = 0; sblock_try[i] != -1; ++i)
+diff -urN grub-0.97.orig/stage2/fsys_vstafs.c grub-0.97/stage2/fsys_vstafs.c
+--- grub-0.97.orig/stage2/fsys_vstafs.c	2003-07-09 11:45:53.000000000 +0000
++++ grub-0.97/stage2/fsys_vstafs.c	2008-09-16 19:32:39.000000000 +0000
+@@ -47,7 +47,7 @@
+ {
+   int retval = 1;
+   
+-  if( (((current_drive & 0x80) || (current_slice != 0))
++  if( (((current_slice != 0))
+        && current_slice != PC_SLICE_TYPE_VSTAFS)
+       ||  ! devread (0, 0, BLOCK_SIZE, (char *) FSYS_BUF)
+       ||  FIRST_SECTOR->fs_magic != 0xDEADFACE)
Signature · 2 lines
All your people must learn before you can reach for the stars.
		-- Kirk, "The Gamesters of Triskelion", stardate 3259.2
#13 lore raw
Quoted 7 lines · Bastian Blank, le Wed 17 Sep 2008 22:08:33 +0200, a écrit :
Quoted 4 lines · Samuel Thibault
Quoted 2 lines · Bastian Blank, le Fri 12 Sep 2008 21:16:36 +0200, a écrit :

Anyway, I found it. It is buried in the filesystem modules of grub in the mount hook.

Cool, I currently don't have much time to spend on these :)

Patch.

Thanks!