On Wed, Jun 29, 2022 at 11:33:12PM +1000, Eyal Lebedinsky wrote: > I do not know if this is a USB thing (but I think so) or an IDE/SATA issue. > > I was reading (dd) a few disks and used two different mounts, one is a direct SATA cable, the other uses > a UDB caddy. > > When I later attempted to loop mount the (dd) images some have failed. The system log show > bad geometry: block count 488378390 exceeds size of device (488378389 blocks) > And sure enough, fdisk shows the device as 4 sectors too short for the partition: > Disk set-68-disk-23.dd: 1.82 TiB, 2000398931968 bytes, 3907029164 sectors > ^^^^^^^^^^ > Units: sectors of 1 * 512 = 512 bytes > Sector size (logical/physical): 512 bytes / 512 bytes > I/O size (minimum/optimal): 512 bytes / 512 bytes > Disklabel type: dos > Disk identifier: 0xb2c564a3 > > Device Boot Start End Sectors Size Id Type > set-68-disk-23.dd1 2048 3907029167 3907027120 1.8T 83 Linux > ^^^^^^^^^^ > This image was copied from the USB caddy. Plugging the disk directly (via SATA cable) I get a good geometry: > Disk /dev/sdj: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors > ^^^^^^^^^^ > > This is a worry, looks like the caddy cannot be trusted. > > I looked and the other copies I made today and it seems that the last 4 sectors are always lost, and the partition end > is beyond the device size. However the mount usually succeeds because the fs does not use the full partition > due to the 4k block size. > > Is this a known/common issue? Is this a problem with the caddy? Historically the problem goes the other way: Lots of devices used to report a total size that was one logical block _larger_ than their actual capacity. This was caused by the firmware authors misunderstanding the READ CAPACITY command, which is supposed to return the block number of the last logical block -- but instead they would return the total number of logical blocks, which is one higher (since the first block is number 0). Nowadays most devices seem to sorted this out. It looks like you found one that makes the opposite mistake: The value it reports is one less than the last block number. It is definitely a bug in the caddy. On the other hand, this bug probably doesn't affect the rest of the caddy's operations. Alan Stern > I never noticed this before and would rather dump the caddy if it is at fault. > > TIA > > -- > Eyal Lebedinsky (eyal@xxxxxxxxxxxxxx)