Testing with multi-terabyte disks shows that HDIO_GETGEO sometimes returns heads=0. This causes parted to die with a Floating Point Exception, among other possible effects. The problem occurs because several routines in scsicam_bios_param cast sector_t capacity to unsigned long. The attached patch avoids this, by checking first to see if the capacity exceeds the maximum allowed values for cylinder/sector/head (65535*63*255). If so, just return those values right away. Tom
--- linux-2.6.12-rc3/drivers/scsi/scsicam.c.orig +++ linux-2.6.12-rc3/drivers/scsi/scsicam.c @@ -59,6 +59,15 @@ int scsicam_bios_param(struct block_devi unsigned char *p; int ret; + /* Are we above the max. allowed for cylinder/sector/head? */ + if (capacity > 65535*63*255) { + ip[0] = 255; + ip[1] = 63; + ip[2] = 65535; + + return 0; + } + p = scsi_bios_ptable(bdev); if (!p) return -1; @@ -86,11 +95,7 @@ int scsicam_bios_param(struct block_devi ip[0] = 64; ip[1] = 32; } - - if (capacity > 65535*63*255) - ip[2] = 65535; - else - ip[2] = (unsigned long)capacity / (ip[0] * ip[1]); + ip[2] = (unsigned long)capacity / (ip[0] * ip[1]); } return 0;