Understanding Hard Disk Sector Size, Part 1: The Change

By March 29, 2016Storage

hard disk sector sizeWhen was the last time you really had to care about the geometry of a hard disk? I would wager it’s been at LEAST 25 years. Well, worry not! We’re back to worrying about hard disk sector size again! Bear with me and I’ll tell you why.

Currently, there are three options: 512 bytes, 512e and 4K and we’ll discuss the differences later — but first, a bit of background.

From 512 Bytes to 4K

For over 30 years we’ve had 512-byte sector sizes on hard disks, meaning the smallest unit that could be allocated on a hard drive was 512 bytes. All file systems were made for that, and assumed that was how it was going to be. However, as hard drives grew in size, along with file size, that 512-byte setting seemed a bit antiquated. When was the last time you created a file that was under a kilobyte in size? Not only that, but if you were using NTFS with the default configuration, even if you had a 768-byte file, it would have been allocated at least 4K because that’s the default and smallest block size of NTFS.

As drives get bigger, that means more and more sectors have to be tracked, which involves more and more overhead. Each sector has a certain amount of overhead (about 65 bytes), which isn’t bad if you only have a few thousand sectors. When you start having millions, though, it starts to add up. If we don’t need that very small size of data, why are we losing that space to overhead? There are even more complicated problems involved with these small sectors, and the hard drive industry made an agreement way back in 2009 to move to 4K for sector size. Take this example from Seagate: six sectors (3K) take up the same space as a single 4k sector due to overhead. That means hard drives can be bigger without increasing areal density, great!

512e

Great! Let’s fix it. These 4K sectors sound like a good idea. If people said we were moving to it in 2009, that means it’s a non-issue, right? Well, no…

Compensating for the Shift (and its Penalties)

The problem with all of this is that OSes have to modify their disk access patterns (file systems) to accommodate for this change from 512 to 4K. The fundamental unit of storage has to be recognizable and changed, which is a lot of work under the covers to do really nothing but make a drive work the same way it always had been. To combat this, the drive manufacturers introduced 512e sectors, which emulate 512-byte sectors on top of the 4k structure that is actually on the disk. Each single 4K sector is divided into eight 512e sectors that are presented to the OS.

In other words, before 512e, if I needed to update a sector, I just sent the 512 bytes to the hard drive, and it wrote that sector. With 512e, however, it’s different because it uses something that should be familiar to those of you who follow our blogs and have read much about SSDs: read-modify-write. This means that if you write to disks, it will allocate a 4K sector and then subdivide it but if you later need to update only one sub-512e sector of that larger one, you have to read the original data, modify it, and then write the new updated 4K sector. The drive can’t write at a unit smaller than 4k, so even though only the 512-byte sector changed, the whole 4K sector has to be re-written. This imposes a write penalty if you hit that situation, which could be quite frequently, with a severe impact … or rare and negligible, and there’s really no way of knowing ahead of time.

Finally, there’s abstraction layers. What if that storage is in a SAN? Just because the physical disks themselves are 512e or 4K doesn’t mean that the volumes presented to the hosts are in 512e or 4K. Modern advanced SANs can normally present either 512 even if the disks behind them are 4K or 512e. That means that hosts can work with 4K disks even if they don’t directly support it.

By now you’re probably thinking, “Okay, that’s all great, but why should I care?” The answer will follow in my next blog.

If you have questions about your storage in general or hard disk sector size, send us an email or give us a call at 502-240-0404.