For NVMe SSDs, use native 4K (4096-byte) sectors if possible
For NVMe disks, we should use native 4K (4096-byte) sectors ("Advanced 4Kn Format") if possible; this gives a ~10% performance enhancement.
It seems that by default NVMe SSDs in FreeBSD are running in 512-byte sectors, which is not ideal:
Users-Laptop% sudo diskinfo -v /dev/nvme0ns1
/dev/nvme0ns1
512 # sectorsize
256060514304 # mediasize in bytes (238G)
500118192 # mediasize in sectors
0 # stripesize
0 # stripeoffset
No # TRIM/UNMAP support
Unknown # Rotation rate in RPM
This is for a Transcend PCIe SSD 220S, which "aims at high-end applications, such as digital audio/video production, gaming, and enterprise use".
How can we know whether a SSD supports native 4K sectors? The data sheet doesn't specify sector size.
smartctl output ("SMART" in Hardware Probe) shows:
Supported LBA Sizes (NSID 0x1)
Id Fmt Data Metadt Rel_Perf
0 + 512 0 0
Does this mean that this SSD will not support 4Kn?
In case it did supoprt 4Kn, would we have to
sudo pkg install nvme-cli
nvmecontrol format --lbaf=1 /dev/XXX
zpool create -o ashift=12 ...
?
And how to tell bsdinstall to do "the right thing"?
NOTE: ashift=12 means that the pool is configured to use a 4K (4096-byte) sector size. In ZFS terminology, this is sometimes referred to as "ashift 12" or "4K alignment."
Why is all of this not happening automatically?
More information:
- Bits inside by René Rebe: You DO NOT use your NVME SSDs to their BEST PERFORMANCE: THIS is the SIMPLE FIX!
Interestingly, on FreeBSD 14.0-RC4 I get with a Samsung SSD 980 PRO:
% sudo smartctl /dev/nda0
smartctl 7.4 2023-08-01 r5530 [FreeBSD 14.0-RC4 amd64] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
Smartctl open device: /dev/nda0 failed: INQUIRY failed
and
% sudo diskinfo -v /dev/nvme0ns1
/dev/nvme0ns1
512 # sectorsize
1000204886016 # mediasize in bytes (932G)
1953525168 # mediasize in sectors
0 # stripesize
0 # stripeoffset
No # TRIM/UNMAP support
Unknown # Rotation rate in RPM
Why does it think it doesn't support TRIM?
@probonopd try running smartctl /dev/nvme0 instead