ibm x345 w/ serveraid-5i + freebsd ips driver dramas

Bruce Evans bde at zeta.org.au
Mon Sep 15 03:22:31 PDT 2003


On Sun, 14 Sep 2003, Nate Lawson wrote:

> On Mon, 15 Sep 2003, Andrew Snow wrote:
> > Problem 2: (the biggest problem)
> >
> > While the drive size is reported correctly, the geometry is wrong...
> > 472 cyls/254 heads/63 sectors = 7552944 sectors (3687MB) ?!
> >
> > When setting the BIOS to "non-extended" (2GB max) support mode, freebsd
> > then thinks this is the geometry:
> > 1846 cyls/128 heads/32 sectors = 7561216 sectors (3692MB).
> >
> > So I tested a few alternate geometries instead and even though there
> > were no error messages, it seemed to get reset to what FreeBSD was
> > reporting, no matter how many ways I tried to use the fdisk utility.
>
> This is not the driver's fault but fdisk's.  I really hate FreeBSD's fdisk
> and do not ever use it.

Do you mean sysinstall?  The fdisk(8) utility returns the geometry set
by the driver to a fault.  E.g., a drive that is reported by the driver
to have (C/H/S) geometry 13328/15/63 is now reported by fdisk to have
geometry 13328/15/63 although its BIOS geometry is 784/255/63 and it
is partitioned with the BIOS geometry.  This is GEOM's fault.  I really
hate GEOM and only use it to test -current's behaviour.  RELENG_4 and
my version of -current still use my MBR code in subr_diskmbr.c.  This
gives the geometry set by the driver if there is no partition table
and the geometry that was apparently used for partitioning otherwise.
The user is reponsible for using a reasonable geometry for the first
partition.  It should be whatever the user chose or accepted for the
BIOS geometry, but many other reasonable and unreasonable geometries
may work if the BIOS reverse-detects the geometry from the partition
table like subr_diskmbr.c.

It's interesting that Linux now gets the geometry wrong in the same
way.  Linux-2.0.30 through Linux-2.4.0-test8 gave 784/2555/63, and old
(1997 and 1996) versions of fdisk and lilo are happy with this.
Linux-2.6.0-test2 gives 13328/15/63, and the old versions of fdisk and
lilo are unhappy with it.  I needed to run lilo to install new kernels
and resorted to 2.4.0 so that it worked.  The 1997 Linux fdisk used
to run fine in readonly mode at lat under FreeBSD until its libraries
went to DLL heaven and it went the other way, except it couldn't detect
the geometry automatically.

A BIOS geometry of 784/255/63 is a simple case.  The drive is larger
than the 500+ MB limit (1024/16/63) but smaller than the 8- GB limit
(1024/255/63), so sysinstall shouldn't have any problems with it.
sysinstall's problems begin at 1024 cylinders.  It doesn't like C >
1024 and breaks the default geometry attempting to make C <= 1024.
>From libdisk/change.c (unifdef PC98):

% void
% Sanitize_Bios_Geom(struct disk *disk)
% {
% 	int sane;
%
% 	sane = 1;
%
% 	if (disk->bios_cyl > 1024)
% 		sane = 0;

Bogus.  C >= 1024 is now normal.  Also has an off-by-1 error here or later.
C = 1024 may cause problems but is considered sane here.

% 	if (disk->bios_hd > 16)
% 		sane = 0;
% 	if (disk->bios_sect > 63)
% 		sane = 0;

These are correct.

% 	if (disk->bios_cyl * disk->bios_hd * disk->bios_sect !=
% 	    disk->chunks->size)
% 		sane = 0;
% 	if (sane)
% 		return;
%
% 	/* First try something that IDE can handle */
% 	disk->bios_sect = 63;
% 	disk->bios_hd = 16;
% 	disk->bios_cyl = disk->chunks->size /
% 		(disk->bios_sect * disk->bios_hd);

Not unreasonable, but it may change a weird but in-use geometry.

%
% 	if (disk->bios_cyl < 1024)
% 		return;

Off-by-1 error here or above.  C = 1024 was accepted above but is rejected
here.

%
% 	/* Hmm, try harder... */
% 	disk->bios_hd = 255;
% 	disk->bios_cyl = disk->chunks->size /
% 		(disk->bios_sect * disk->bios_hd);
% }

Bogus.  At least on current model ATA disks which are far too large for
C < 1024 to be possible, the normal geometry seems to be the firmware
one again (C=big/H=16/S=63).

>From sysinstall/disks.c:

% #ifdef PC98
%     if (d->bios_cyl >= 65536 || d->bios_hd > 16 || d->bios_sect >= 256) {
% #else
%     if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
% #endif
% 	dialog_clear_norefresh();
% 	msgConfirm("WARNING:  A geometry of %lu/%lu/%lu for %s is incorrect.  Using\n"
% 		   "a more likely geometry.  If this geometry is incorrect or you\n"

This alarming warning is now printed for almost all new disks in the
non-PC98 case -- 80GB disks are now small but are 10 times too large to
fit the 65535/16/255 limit.

Bruce


More information about the freebsd-scsi mailing list