Is the default 512 byte physical sector size appropriate for SSD disks under Linux?
In the old days, 512 byte sectors was the norm for disks. The system used to read/write sectors only one sector at a time, and that was the best that the old hard drives could do.
Now, with modern drives being so dense, and so fast, and so smart, reading/writing sectors only one sector at a time really slows down total throughput.
The trick was... how do you speed up total throughput, but still maintain compatibility with old/standard disk subsystems? You create a 4096 block size that are made up of eight 512 byte physical sectors. 4096 is now the minimum read/write transfer to/from the disk, but it's handed off in compatible 512 byte chucks to the OS.
This means that even if the system only needs one 512 byte sector of information, the drive reads eight 512 byte sectors to get it. If however, the system needs the next seven sectors, it's already read them, so no disk I/O needs to occur... hence a speed increase in total throughput.
Modern operating systems can fully take advantage of native 4K block sizes of modern drives.
According to Wikipedia "Advanced Format (AF) is any disk sector format used to store data in disk drives that exceeds 512, 520, or 528 bytes per sector, such as the 4096-byte sectors of an Advanced Format Drive (AFD)." Advanced Format (AF) is a disk format that natively uses a sector size of 4,096 bytes instead of 512 bytes. To maintain compatibility with legacy systems, AF disks emulate a sector size of 512 bytes.
I got the same results as you got by running sudo fdisk -l /dev/sdX
(where X
is a letter) on two SSDs. I also got the same results as you got by running stat -f
and smartctl
on two SSDs. Both SSDs were automatically recognized by the OS when they were installed and required zero configuration, so it appears that the data you got is the default settings for block size and sector size.
Is the default 512 byte physical sector size appropriate for SSD disks under Linux?
Both of my disks are SSDs and AFAIK SSD disks require a sector size of 4K. Is this OK or am I missing something?
Old hardware and Operating Systems used 512 byte sectors, since 2011 (almost) all storage hardware has 4096 (or larger) byte sectors; but some hardware supports emulation of 512 byte sectors for legacy systems. There are exceptions, the Samsung 840 EVO SSD has blocks of size 2048 KB.
An Error Correcting Code (ECC) is calculated for each 512 byte chunk, and as you can imagine, ECC data also requires storage space. It goes without saying that one 4096 byte sector requires less ECC information than eight 512 byte chunks if the ECC algorithms remain unchanged. In the end, the total storage capacity of a hard drive increases as a result of less ECC data overhead.
Using 4K sectors makes sense from an architectural standpoint, as other key figures (like x86 memory pages and many file system clusters) also employ the 4 KB size. The Advanced Format allows for more robust ECC algorithms, which is important in light of ever-increasing capacities. Controllers employ additional techniques beyond error correction through an understanding of the NAND flash memory error characteristics and the workload behavior.
Advanced Format (AF) is any disk sector format used to store data on magnetic disks in hard disk drives (HDDs) that exceeds 512, 520, or 528 bytes per sector, such as the 4096, 4112, 4160, and 4224-byte (4 KB) sectors of an Advanced Format Drive (AFD). Larger sectors enable the integration of stronger error correction algorithms to maintain data integrity at higher storage densities.
For SCSI (SAS) disks the RAID block size is larger than a JBOD block size due to the SCSI T10 standardized data integrity fields along with logical bad block checking stored on each block with the data. The SAS RAID adapters support disk blocks based on 512 Bytes of data or 4K Bytes of data. The RAID block size for the 512 disks is 528 Bytes per sector and the RAID block size for the 4K disks is 4224 bytes per sector.
Because you are writing to memory and not a spinning disk physical sector size has less effect than ensuring that your partitions are aligned with the erase block size. Even so it's best to have up to date software and hardware, and use 4K sector size.
The larger sector size is recommended by Intel - "Gain Optimal Performance by Changes to SSD Physical Sector Size".