You are not logged in.

#1 2024-03-01 07:58:59

webcapcha
Member
Registered: 2019-02-14
Posts: 167

[SOLVED] How to make sure NVMe block size is correct?

All commands from https://wiki.archlinux.org/title/Advanced_Format

# nvme id-ns -H /dev/nvme0n1 | grep "Relative Performance"
# smartctl -c /dev/nvme0n1

report I have block size 512b

as well as

# cryptsetup luksDump device | grep sector

reports

sector: 512 bytes

fdisk -l also reporting block size 512 bytes

NVMe disk model SKHynix_HFS001TEJ4X112N

Last edited by webcapcha (2024-03-04 07:02:18)


Ukrainian

Offline

#2 2024-03-01 08:50:27

frostschutz
Member
Registered: 2013-11-15
Posts: 1,647

Re: [SOLVED] How to make sure NVMe block size is correct?

Changing sector size will lose you all data (or in case of LUKS, require re-encryption); unless you're running very performance critical applications, it's usually not worth the bother. Filesystem alignment is important, everything else is optional.

Performance issues with SSD/NVME are usually for other reasons outside of your control (cache issues, degradation / error correction, temperatures under load, etc.) and changing the sector size will have little effect on that.

If you do decide to change it, you'll have to run your own benchmarks to determine if it helps at all or not.

Offline

#3 2024-03-01 08:56:35

webcapcha
Member
Registered: 2019-02-14
Posts: 167

Re: [SOLVED] How to make sure NVMe block size is correct?

Yes I am familiar that changing sector size will erase all data.
Actually I tried with

nvme format --lbaf=1 /dev/nvme0n1

but it can't be changed to 4096 because of lacking those option. I just can't see in the output of any command number 4096.


Ukrainian

Offline

#4 2024-03-01 09:01:06

webcapcha
Member
Registered: 2019-02-14
Posts: 167

Re: [SOLVED] How to make sure NVMe block size is correct?

Besides script on the https://wiki.archlinux.org/title/Advanc … _alignment any other option to check alignment?


Ukrainian

Offline

#5 2024-03-01 09:57:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,231

Re: [SOLVED] How to make sure NVMe block size is correct?

Afaik most nvme controllers do alignment internally and they just expose "some value" so traditional partitioning tools don't explode. I doubt you can -- and should not -- be doing much about that.

Offline

#6 2024-03-01 09:57:10

frostschutz
Member
Registered: 2013-11-15
Posts: 1,647

Re: [SOLVED] How to make sure NVMe block size is correct?

Partition alignment? You can check `head /sys/block/*/*/start` (this lists the start offsets of each partition in your system) and for MiB alignment, each number should be a multiple of 2048; for 4K alignment, a multiple of 8; assuming 512 byte sectors.

However for filesystem alignment, the offsets of LUKS, RAID, LVM etc. also matter (if you use other storage layers between partition and filesystem). It's just that pretty much everything aligns by default these days so there is rarely a need to actually go and check.

webcapcha wrote:

Actually I tried with

nvme format --lbaf=1 /dev/nvme0n1

This could mean anything, not necessarily 4096 sector size. 1 is just an arbitrary ID as listed by id-ns or smartctl -c commands.

nvme is a "dangerous" tool, it can delete your data and screw you up other ways, you don't want to blindly run commands here.

webcapcha wrote:

I just can't see in the output of any command number 4096.

Not all devices support it... if in doubt, just leave as is. Sticking to default settings has its own merits. Less likely to trigger firmware bugs and other compatibility issues.

Offline

Board footer

Powered by FluxBB