We thought of that years ago. Unfortunately there is no reliable way
of telling when a capacity value is wrong. There definitely do exist
disks with an odd number of sectors.
Furthermore, doing I/O to a suspect block is not a good idea. There
are plenty of devices which simply crash when you try to access a
nonexistent sector.
I imagine they do. However Linux has partition code that stores
information in the last sector of a partition (EFI GUID and md, for
example). Other OS's apparently do not try to access the medium's last
sector under most circumstances.
usb-storage isn't in the business of altering the data it gets from a
device. It's just a transport. That's why the sdev->fix_capacity flag
exists; we tell the upper layer that the data it gets is going to be
wrong and let the upper layer worry about fixing things up.
No, partition scanning. Also maybe /lib/udev/vol_id, which seems to
read an inordinate number of irrelevant sectors.
Alan Stern
--