Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For NVMe SSDs, use native 4K (4096-byte) sectors if possible #531

Open
probonopd opened this issue Sep 10, 2023 · 2 comments
Open

For NVMe SSDs, use native 4K (4096-byte) sectors if possible #531

probonopd opened this issue Sep 10, 2023 · 2 comments
Labels
freebsd Needs FreeBSD expertise and/or work help wanted Extra attention is needed

Comments

@probonopd
Copy link
Member

probonopd commented Sep 10, 2023

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:

@probonopd probonopd added help wanted Extra attention is needed freebsd Needs FreeBSD expertise and/or work labels Sep 10, 2023
@probonopd
Copy link
Member Author

probonopd commented Nov 12, 2023

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?

@svmhdvn
Copy link

svmhdvn commented Apr 7, 2024

@probonopd try running smartctl /dev/nvme0 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
freebsd Needs FreeBSD expertise and/or work help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants