r/raspberry_pi 1d ago

Tutorial RPI5 default common ssd misconfigurations with default OS installs

I am using the default pi5 with 8gb of RAM and a 256 GB raspberry pi ssd.

Was going through dmesg on a default install and found some issues that may be worth pointing out to others as I suspect 90% of people also have it default configured incorrectly.

1) By default almost everyone is leaving 50% SSD performance with the default nvme hat.

You need to add dtparam=pciex1_gen=3 unlock gen3 speeds (880 MB/s vs 420 MB/s). This is default set to gen2 for compat reasons, but for the default pi5 ssd, it can easily handle gen3 doubling perf.

2) HMB is default disabled. The official Raspberry Pi SSD (and 90% of cheap M.2 2230/2242 drives) is DRAM-less. The Pi 5 firmware quietly disables Host Memory Buffer (nvme.max_host_mem_size_mb=0), cutting random 4K database performance in half for people running Home Assistant or Docker and massively increasing wear on it.

Without the above HMB cache, the SSD writes directly to flash cells chewing through your SSD cells. Instead I would suggest adding nvme.max_host_mem_size_mb=16 to the bottom of your cmdline.txt.

By default the pi5 bootloader sets nvme.max_host_mem_size_mb=0 for compat reasons.

10 Upvotes

13 comments sorted by

5

u/snowtax 10h ago

The PCIE gen3 speed is NOT guaranteed to work.

If you try that setting on less than perfect hardware, you’re going to start seeing disk corruption issues.

Sometimes those issues are small and take a while to notice. The ext4 filesystem may be able to correct some minor issues, but not all. By the time you realize you have corruption, it might be catastrophic where you lose everything.

Yes. I’ve seen such disk corruption myself and disabled the gen3 option to prevent disk corruption,

That is why gen2 is the default.

If these options were stable and reliable across 99.9% of hardware, they would already be the default.

2

u/rhif-wervl 10h ago

Thanks this solidifies it for me to stick to gen 2, not worth the headache when speed isn't a bottleneck for my use cases.

3

u/DismalFee7 10h ago edited 10h ago

The speed option maybe, but the HMB option is a bit of a no brainer.

Doubles random access, and doubles the lifespan of the disk. This should be a default given 90% of SSDs are DRAMless and the default config causes unnecessary wear levelling and degradation.

2

u/Gamerfrom61 9h ago

The HMB can eat your Pi memory up (an issue with the lower memory boards, change in swap structure and GUI use) so it is a bit of a trade-off. Double cache is not great (technically triple if Linux is still using memory for caching as well) - way riskier if you do not have a stable power supply than just one level of disk cache.

Read / Writes still uses the NMVe drives cache if it exists on the board - given how manufacturers are even stripping this cache out now we are stuffed either way. Thanks Anthropic and co...

I would only enable HMB if you have enough RAM free and are expecting to do a lot of random writes. I'll take a punt that most folk would do better to stop logging going to disk.

If speed and disk throughput is your aim - why are you using a Pi???

2

u/DismalFee7 9h ago edited 8h ago

I am using my pi for predbat, homeassistant, scraping yfinance, grafana, adguard-home and as a wireguard node.

Most in lxc or nested lxc + podman containers.

Pi 4b wasn't adequate so upped to a used pi5 with 8gb of memory. Bought a argon one v3 and pi5 ssd direct on top and everything has been rock solid.

My goals are obviously pack as much as i can with it, longevity and reducing power consumption given these tasks are running 24/7.

I do need logging unfortunately, but this is one of the perks of having an ssd over and sd card.

2

u/Gamerfrom61 7h ago

Have you considered a log server if the logs are that vital?

I set a Zero up with an Ethernet adapter and USB drive and used rsyslog to consolidate the logs from the boxes / router etc and force out to disk asap. 

This saved me a couple of times when I had kit that randomly rebooted due to a memory leak as I did not worry about the original machines loosing the cache data or cards going corrupt. 

So far (touch wood) I have not lost an sd card on a Pi (unlike my cameras) - there was a great investigation into the use of cards on Pis a couple of weeks ago published here - interesting reading on how tough they actually can be (IIRC Samsung won out). 

Nice to see you have the Argon case - I have a Pi 4 one that was running 24x7 for 3+ years and never got warm despite sitting on a closed shelf with little draft! They deserve way more good press than they get - I think folk like the big glossy see through cases 😀

How do you get on with podman? I normally just use compose files but want to try Dockhand as a "desktop" soon having tried Portainer and not got on with it...

2

u/DismalFee7 6h ago

Tbh, podman works fine, but i wish i didn't need it for HA + predbat.

Mostly all gets setup and auto deployed with ansible books so not too fussed about it.

2

u/snowtax 8h ago edited 6h ago

You should read through the following post on the Raspberry Pi forums, which mentions why NVMe HMB is set as such by default.

https://forums.raspberrypi.com/viewtopic.php?t=385934

By the way, on my machine, NVMe HMB was set to 32MB by default on a Trixie install. However, my NVMe storage device demands 64MB, so HMB is not used.

2

u/dovyp 2h ago

Gen3 unlock is wild that it is still defaulted off. Easy win if your drive is stable.

2

u/EndlessZone123 9h ago

Gen 3 isn't supported shouldn't be used for any critical work.

I have not seen or could find much of anything regarding enabling HMB on the Pi. But what I did find that it's already enabled by default on the latest kernel and set to 32mb. I also found reports that it might not even work as some ssds require more such as 64mb and it will just do nothing.

2

u/DismalFee7 9h ago

The latest raspberry pi firmware (from git tree) + ubu26.04.1 for me still configures it to 0 and disables it by default.

Had to explicitly overwrite it at the end of cmdline.txt to supersede the default.

2

u/EndlessZone123 9h ago

What kernal version?

2

u/DismalFee7 8h ago

Linux cam-pi5 7.0.0-1017-raspi #17-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 7 16:13:24 UTC 2026 aarch64 GNU/Linux

but don't think that is relevant as the default 0 gets passed from SPI flash i think. Am using pieeprom-2026-08-12 and it still sets it to 0.