hdparm -I /dev/sdbFortunately, it seems that newer models correctly report 4K sectors:
ATA device, with non-removable media
Model Number: WDC WD15EARS-00Z5B1
Serial Number: WD-WMAVUxxxxxxx
Firmware Revision: 80.00A80
[...]
Logical/Physical Sector size: 512 bytes
ATA device, with non-removable mediaNow the good news. Fedora-13 and all related upstream projects are ready for 4096-byte sector disks. The libparted, fdisk, mkfs.{ext[234],xfs,gfs2} and cryptsetup (upstream, Fedora-14 and RHEL6) have been enhanced to use the new I/O topology to properly align things on the devices.
Model Number: WDC WD15EARS-00Z5B1
Serial Number: WD-WMAVUxxxxxxx
Firmware Revision: 80.00A80
[...]
Logical Sector size: 512 bytes
Physical Sector size: 4096 bytes
Logical Sector-0 offset: 0 bytes
The I/O topology (aka "I/O limits") is supported since kernel 2.6.31. The topology is exported to userspace by sysfs, for example:
$ cat /sys/block/sdb/queue/physical_block_sizeThe kernel also supports topology ioctls since 2.6.32. The parted, fdisk and mkfs.{ext,xfs} use libblkid to get the topology, but some other tools directly use ioctls. So it's better to have kernel 2.6.32 or .33.
4096
$ cat /sys/block/sdb/queue/logical_block_size
512
$ cat /sys/block/sdb/queue/optimal_io_size
32768
The fdisk(8) command uses 1MiB offset and grain to align partitions by default. So the final partition table is usable on hard drives with 4096-byte sectors by default. It means independently on the disk topology. This is the good news for WDxxEARS users.
If you want to use fdisk(8) then think twice and don't forget that fdisk is a low-level tool. Some fdiks(8) hints:
- use fdisk from util-linux-ng >= 2.17.2
- read warnings
- don't use DOS-compatible mode (for backward compatibility this mode is enable by default, you have to use command 'c' or '-c' command line option to disable DOS mode. Note that for the next major release the DOS mode will be disable by default.)
- use sectors as display units (command 'u' or '-u' command line option)
- all default sizes/offsets are aligned to the physical block boundary (e.g. "First sector" dialog always provides aligned default)
- use +size{M,G} convention to specify "Last sector" (e.g. +5G to create 5GiB partition) then fdiskl aligns the size to physical block boundary
- don't forget that fdisk(8) always follows your wishes -- it means that if you explicitly define first/last sector number then the partition could be misaligned
- the 'p' (print) command checks for partitions alignment
https://ata.wiki.kernel.org/index.php/ATA_4_KiB_sector_issues
http://people.redhat.com/msnitzer/docs/io-limits.txt
thanks for this explanation,
ReplyDelete"util-linux-ng >= 2.17.2" was the key to my puzzle