On Sun, Dec 08, 2024 at 11:26:51PM +0700, Max Nikulin wrote:
I switched this NVME drive to 4k mode. However I considered your
message as statement that internally drives still use higher erase
block size
The erase block is going to be many megabytes, it has nothing to do with
the logical blocks. The erase block isn't erased as each logical block
is written, it is erased when it's empty. Many logical blocks can be
written (sequentially) over time to the same erase block. Some drives
work better with 4k logical blocks but in general I don't recommend
using them--having a mix of 4k and 512b blocks on a system is a bit of a
pain, and it makes replacing a drive more complicated. Not all drives
support 4k, and many that do get no benefit from such a configuration.
E.g.:
# nvme id-ns -H /dev/nvme0n1 | grep Rel
LBA Format 0 : Metadata Size: 0 bytes - Data Size: 512 bytes - Relative
Performance: 0 Best (in use)
LBA Format 1 : Metadata Size: 0 bytes - Data Size: 4096 bytes - Relative Performance: 0 Best
This drive supports either format, but both are "Best". Other drives
will recommend one or the other:
# nvme id-ns -H /dev/nvme0n1 | grep Rel
LBA Format 0 : Metadata Size: 0 bytes - Data Size: 512 bytes - Relative
Performance: 0x2 Good (in use)
LBA Format 1 : Metadata Size: 0 bytes - Data Size: 4096 bytes - Relative Performance: 0x1 Better
Or support only one:
# nvme id-ns -H /dev/nvme1n1 | grep Rel
LBA Format 0 : Metadata Size: 0 bytes - Data Size: 512 bytes - Relative
Performance: 0 Best (in use)
I'd rather just stick with 512b and not worry about it. Of the drives
above, the one which doesn't care is the newest/fastest. It likely
supports 4k format because it's a U.3 drive which could be used in a
storage array already configured for 4k. The other two are in the same
LVM VG, and if one of them were formatted 4k I wouldn't be able to
migrate volumes between them (so any possible, likely not noticeable,
performance benefit from a 4k format would be outweighed by the
inconvenience.) The one that recommends a 4k format is the oldest,
smallest, and slowest by far (Gen3 vs Gen4) and at best is half the
speed of the others, regardless of format.