Partitioning – What’s the point of hard drives reporting their physical sector size?

I have an SSD that can be configured to report its physical sector size to an OS in two different ways:

Option 1: Logical = 512 Bytes, Physical = 512 Bytes

Option 2: Logical = 512 Bytes, Physical = 4096 Bytes (4K)

What benefit does an OS gain by being aware of the 4K physical sector size, considering:

  • The OS must talk to the drive in 512-byte sectors regardless

  • All modern OSes align to 4K and utilize 4K or multiples of 4K I/O regardless

The setting seems pointless, because modern OSes are already optimized for 4K sector drives. Modern OSes don’t need to “ask” a drive whether its sectors are 512b or 4K, because the OS does everything in a 4K-friendly way by default.

For example, Windows 7 aligns partitions to 1MB (a multiple of 4K), NTFS cluster size is 4K or multiple thereof, and all I/O is done in 4K or multiple thereof. Windows doesn’t give a damn what hard drive you have, it will apply the above behavior in all cases.

Anyway… my SSD has this “physical sector size” setting and so it must be there for some good reason… it’s the reason for this I’m looking for.

BTW, for what it’s worth, the drive is an Intel SSD DC S3510. The drive’s datasheet says this (page 27):

 

By using SCT command 0xD801 with State=0, Option=1, ID Word 106 can be changed from 0x6003 to 0x4000 (4KB physical sector size to 512B physical sector size support change).

Solution:

The 512-byte emulation is intended for compatibility with older systems. However, writes involving only part of a physical 4K sector can cause reduced performance because the sector needs to be read and modified before it can actually be written.

When a legacy operating system tries to write to an Advanced Format disk, performance issues can arise because the logical sectors written may not match up with the physical sectors.

  • When only part of a 4K physical sector is read, the data is simply read off the physical sector and there is no reduction in performance. However, when the system tries to write to part of a physical sector (e.g. an emulated 512-byte sector rather than the whole physical sector), the hard drive needs to read the whole physical sector, modify the changed portion in the hard drive’s internal memory, and write it back to the platters. This is called read-modify-write (RMW), an operation which requires an extra rotation of the disk and therefore reduces performance. Seagate explains this as follows:

 

[…] the hard drive must first read the entire 4K sector containing the targeted location of the host write request, merge the existing data with the new data and then rewrite the entire 4K sector:

   

Read-modify-write cycle

   

In this instance, the hard drive must perform extra mechanical steps in the form of reading a 4K sector, modifying the contents and then writing the data. This process is called a read-modify-write cycle, which is undesirable because it has a negative impact on hard drive performance.

Disk partitions that are not aligned to a 4K boundary can cause degraded performance as well.

  • Traditionally, the first partition on a hard disk starts at sector 63. Windows XP and older operating systems partitioned disks in this manner. Newer versions of Windows will create partitions on a 1 MB boundary, ensuring proper alignment to the physical sectors. This is called Alignment 0.

  • Because LBA 63 is not a multiple of 8 (eight 512-byte legacy sectors fit into a 4K sector), an Advanced Format disk which is formatted in the old manner will have clusters (the smallest unit of filesystem data allocation, typically 4K in size) that are not aligned to the physical sectors on a 4K disk, a condition called Alignment 1. As a result, an I/O operation that otherwise involves 4K of data now spans two sectors leading to a read-modify-write operation that reduces performance.

While information about physical sector size is unnecessary if the OS always writes data on a 4K boundary, this information may still be needed by applications which perform low-level I/O.

  • When a drive reports that its physical sector size is 4K, the OS or application can tell that it is an Advanced Format drive and therefore must avoid performing I/O operations that do not span full physical sectors. A drive that reports 512-byte native sectors does not impose this restriction. While newer operating systems will usually try to read or write data in 4K units whenever possible (making this information irrelevant), applications which perform low-level I/O may need to know the physical sector size so that they can adjust accordingly and avoid misaligned or partial-sector writes that cause slow RMW cycles.

Your SSD provides the ability to change the reported physical sector size because it is necessary for compatibility with certain storage arrays.

  • Datacenters often have storage arrays consisting of legacy 512n drives. 4K drives, even those that emulate 512-byte sectors, may not be compatible with such arrays, so this feature is necessary to ensure compatibility. See this forum thread:

     

    We can’t just stick a 4K drive in an array formatted with 512b disks. Many arrays (most notably ZFS based storage, which is increasingly popular as software defined storage makes waves) will not accept a replacement drive with a different physical sector format.

    Note that better performance will be attained on modern systems if the drive is configured to use 4K sectors.