Sample Header Ad - 728x90

Are there any benefits in setting a HDD's logical sector size to 4Kn?

4 votes
2 answers
3352 views
Modern HDDs all are "Advanced Format " ones, e.g. by default they report a logical/physical sector size of 512/4096. By default, most Linux formatting tools use a block size of 4096 bytes (at least that's the default on Debian/EXT4). Until today, I thought that this was kind of optimized : Linux/EXT4 sends chunks of 4K data to the HDD, which can handle them optimally, even though its logical sector size is 512K. But today I read this quite recent (2021) post . The guy did some HDD benchmarks, in order to check if switching his HDD's logical sector size from 512e to 4Kn would provide better performances. His conclusion : > Remember: My theory going in was that the filesystem uses 4k blocks, and everything is properly aligned, so there shouldn’t be a meaningful difference.\ \ Does that hold up? Well, no. Not at all. (...) Using 4kb blocks… there’s an awfully big difference here. This is single threaded benchmarking, but there is consistently a huge lead going to the 4k sector drive here on 4kb block transfers. (...)\ \ **Conclusions: Use 4k Sectors!**\ As far as I’m concerned, the conclusions here are pretty clear. If you’ve got a modern operating system that can handle 4k sectors, and your drives support operating either as 512 byte or 4k sectors, convert your drives to 4k native sectors before doing anything else. Then go on your way and let the OS deal with it. Basically, his conclusion was that there was quite a performance improvement in switching the HDD's logical sector size to 4Kn, vs the out-of-box 512e : enter image description here Now, an important thing to note : that particular benchmark was single threaded. He also did a 4-threaded benchmark, which didn't show any significant differences between 512e and 4Kn. Thus my questions : - His conclusion holds up only if you have single threaded processes that read/write on the drive. Does Linux have such single threaded processes ? - And thus, would you recommend to set a HDD's logical sector size to 4Kn ?
Asked by ChennyStar (1969 rep)
Nov 13, 2023, 05:16 PM
Last activity: Nov 17, 2023, 02:21 PM