fdisk (at least with the -u option) does not handle sector sizes other than 512 correctly: # modprobe scsi_debug sector_size=4096 # fdisk -u /dev/sdd Note: sector size is 4096 (not 512) Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x4afdb02f. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First sector (32-16383, default 32): Using default value 32 Last sector, +sectors or +size{K,M,G} (32-16383, default 16383): Using default value 16383 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. # dmesg | tail -n 2 sdd: sdd1 sdd: p1 size 130816 limited to end of disk # fdisk -l /dev/sdd Note: sector size is 4096 (not 512) Disk /dev/sdd: 8 MB, 8388608 bytes 8 heads, 32 sectors/track, 8 cylinders Units = cylinders of 256 * 4096 = 1048576 bytes Disk identifier: 0x4afdb02f Device Boot Start End Blocks Id System /dev/sdd1 1 64 65408 83 Linux I think the only problem is that it is suggesting a default of last sector based on 512-byte sectors, not the 4k sectors. I'll attach a patch that may be reasonable ... -Eric
Created attachment 333094 [details] potential patch potential patch; made "sector_factor" a global, and use it in place of "sector_size/512"; also modify the limit in add_partition by this amount.
Applied to upstream tree. http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git I found some others places in util-linux-ng where is mess around hard sectors. Thanks!