Bug#261136: grub: disk geometry incorrectly recognized

Nino Saban Nino Saban <nino.saban@zg.htnet.hr>, 261136@bugs.debian.org
Sat, 24 Jul 2004 01:22:24 +0200


Package: grub
Version: 0.95+cvs20040624-4
Severity: normal

In this configuration lilo works perfectly,
but grub does not work correctly.

---------------------------------------------------
Hardware:
  Gigabyte motherboard (Aladdin V chipset)
	with onboard IDE controller
	(BIOS from year 2000)
  AMD K6-2 CPU
  2 disks
	IBM-DJNA-371800	(18 GB drive) = /dev/hda
	MAXTOR 6L080L4	(80 GB drive) = /dev/hdb
  DVD-ROM on /dev/hdc
  Floppy 1.44 MB
---------------------------------------------------

In BIOS I set the boot order to
	D,A,SCSI
and using /boot/grub/device.map
===============================
(fd0) /dev/fd0
(hd0) /dev/hdb
(hd1) /dev/hda
===============================

I put grub (0.95+cvs20040624-4)
in the MBR of /dev/hdb.

Debian partitions are /dev/hdb* and Debian
correctly boots from them.

But when grub boots and I go to command line

=====================================================================
grub> geometry (hd1)
drive 0x81: C/H/S = 1023/128/63, The number of sectors = 8257536, LBA
   Partition num: 0,  Filesystem type unknown, partition type 0x7
   Partition num: 1,
Error 18: Selected cylinder exceeds maximum supported by BIOS
=====================================================================

Also, when chainloader is called for /dev/hda partitions,
I cannot boot OS on /dev/hda*, and Error 18 also appears
(geometry (hd0) for /dev/hdb works fine, though).


"geometry (hd1)" does not cause error when
called in grub shell.

=====================================================================
# grub --batch --device-map /boot/grub/device.map
grub> geometry (hd1)
drive 0x81: C/H/S = 4370/128/63, The number of sectors = 35239680,
                                                         /dev/hda
   Partition num: 0,  Filesystem type unknown, partition type 0x7
   Partition num: 1,  Filesystem type unknown, partition type 0x7
   Partition num: 4,  Filesystem type is ext2fs, partition type 0x83
=====================================================================

This is the geometry also reported by "sfdisk".


I tried to go to BIOS, and changed Auto (for disk mode detection)
to do manual drive geometry autodetection for /dev/hda
and it offers the following values.

SIZE	CYLS	HEAD	PRECOMP	LANDZ	MODE
--------------------------------------------
18039	2193	255	0	34959	LBA	(default)
18043	34960	16	65535	34959	NORMAL
18043	4370	128	65535	34959	LARGE
--------------------------------------------

So it seems both "sfdisk" and "grub" shell from OS
think of disk in terms of "LARGE" and not "LBA" 
configuration (although LBA is default when set to Auto,
I assume).

I experimented, a bit more, and forcefully changed in BIOS CMOS
configuration from BIOS Auto to BIOS User defined as
suggested by LARGE configuration.

Oddly enough, when grub booted in this LARGE configuration, I tried
geometry command for (hd1) on grub boot loader command line, and
Error 18 did not appear any more.
Now, disk correctly showed all partitions, but still with
incorrect number of CYLINDERS and HEADS, while total number
of sectors was close to expected.

=====================================================================
grub> geometry (hd1)
drive 0x81: C/H/S = 1023/240/63, The number of sectors = 35229600, LBA
   Partition num: 0,  Filesystem type unknown, partition type 0x7
   Partition num: 1,  Filesystem type unknown, partition type 0x7
   Partition num: 4,  Filesystem type is ext2fs, partition type 0x83
=====================================================================


What is happenning?
(same problem in older grub 0.93)

Is this a BUGGY BIOS !?

The same system has worked in the same configuration perfectly,
using lilo for years (including the same type of chainloading).

I found one other report on the Web with similar error
(no resolution), where reported disk incorrectly gave
geometry
	1023/64/63

-- System Information:
Debian Release: 3.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i586)
Kernel: Linux 2.6.6-1-386
Locale: LANG=C, LC_CTYPE=C