I am new to disks. I wrote a block disk driver, and am trying to debug
it based on what userspace apps expect.

1) Why would fdisk not use the disk geometry returned by
ioctl(HD_GETGEO) but some other value it has determined? Namely the
cylinder and head fields are not what I am returning from the driver.

2) How does a mkfs tool (such as mke2fs.jffs or mke2fs.ext3) determine
the size of a partition? Doing an fstat() on e.g.
/dev/blockdev_partition1 or something else? The actual problem is,
mke2fs.ext3 tries to write beyond the end of maximum available sectors
on the disk.