# 512b sector size on consumer SSD



## Nyakov (Mar 14, 2019)

I have 3 cheap consumer SSDs on hands and all of them reporting 512b sector size physical and logical.
And this is confuses me.
So I wonder, should I actually create ZFS pools on them with 512b sector size? Or I still should go with 4k?


----------



## tommiie (Mar 14, 2019)

You should still go with 4k. Should you later replace the disks one-by-one and the new disks have a sector size of 4k, you're golden. If you set it now to 512b and you want to replace the disks with new ones which have 4k sectors, you're in deep shit.


----------



## SirDice (Mar 14, 2019)

Consumer disks (both SSD and HDD) often flat out lie about their sector size. This is done for compatibility reasons with older operating systems. I agree with tommiie just go with 4K regardless of what the disk reports.


----------



## Nyakov (Mar 14, 2019)

I have not encountered consumer modern(after 2012) hdd that will lie both about physical and logical sector size. They all report 4k logical sectors.
This is from where my confusion came.

The is a lots of reasons to use 4k sector in ZFS, yes.

But *why* this SSDs report 512b sectors?
If this was only compatibility thing then I expected the same behavior as HDD - report 512b physical sector size and 4k logical.
I looked to Silicon Motion flash tools, and it seams that they write this values by default in firmware...

There is also scenarios of storing a lots of small file.
So perhaps if SSD actually feel good about 512b sectors then this scenarios can benefit from this.


----------



## PMc (Mar 14, 2019)

From what I could find out, (some?) SSDs seem rather to have an internal blocksize of 8k. But there is a huge confusion about that, and solid information is rare.
Even then, 4k seems to me the best choice for ZFS, as a pool may span moving disks and SSD (l2arc), and setting it all to 8k is quite a loss on small files.


----------



## ralphbsz (Mar 14, 2019)

Internal block size of SSDs is very implementation dependent, and is a closely guarded industry secret.  It is often not a power of two (because of internal redundancy and error correction), and is nearly always much larger than 4K on modern production SSDs.

Second the recommendation for 4K block size.  SSD FTLs typically optimize for that internally.  Unless you have a huge number of tiny files (not hundreds and hundreds, but hundreds of millions), in which case you are probably using your file system in a fashion that is guaranteed to give bad performance.


----------

