[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] Re: grub 0.96 bug



> grub> device (hd0) /dev/mapper/hpt37x_ehgjaggaf
> grub> device (hd0,5) /dev/mapper/hpt37x_ehgjaggaf6
> grub> root (hd0,5)/boot
> Attempt to open drive 0x80 (/dev/mapper/hpt37x_ehgjaggaf6)
> Error 5: Partition table invalid or corrupt
> grub> root (hd0,5)/boot
> Attempt to open drive 0x80 (/dev/mapper/hpt37x_ehgjaggaf6)
> Error 5: Partition table invalid or corrupt

Think it tries to read a partition table out of a logical partition, humn...
No idea where to look for this bug; hints appreciated.

> grub> root (hd0,5)/boot
> Attempt to open drive 0x80 (/dev/mapper/hpt37x_ehgjaggaf)
> Error 18: Selected cylinder exceeds maximum supported by BIOS

Examining further, GRUB thinks the disk has only 4999680 sectors.
It corresponds to about 2.441 MB, while the disk is really about 160.000 MB.

Looking through the source code, the above sector value is some insane
default in GRUB.
The code tries to use 3 different ways of getting the sector count:

1.) ioctl(fd, HDIO_GETGEO) call in lib/device.c
Fails with error -1.
Documentation/hdio.txt from kernel sources has this to say with
regards to that function:
"Not particularly useful with modern disk drives, whose geometry is a
polite fiction anyway. "

2.) fstat (fd, &st)
Fails with error 0.
No idea what this should do :-).

3.) ioctl(fd, BLKGETSIZE) call in lib/device.c
This works for device-mapped devices!
Seems to be a widely used function, there's even a 64-bit version.
Unfortunately, GRUB only attempts this approach after having
*successfully* retrieved cylinder, head and sector values through
HDIO_GETGEO.


I've gone ahead and solved my problems myself; the attached patch
fixes GRUB 0.96 to work correctly (at least for me) with device-mapped
devices.

This is my first hack ever with anything Linux-ie.
So go ahead and flame at will :-).

Attachment: grub-0.96-devicemapper.patch
Description: Binary data

GNU GRUB  version 0.96  (640K lower / 3072K upper memory)
grub> device (hd0) /dev/mapper/hpt37x_ehgjaggaf

grub> root (hd0,5)
Attempt to open drive 0x80 (/dev/mapper/hpt37x_ehgjaggaf)
Filesystem type is reiserfs, partition type 0x83

grub>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]