Raspberry PI5 NVME - PCIe gen config

I recently migrated HA OS to raspi 5 with pineberrypi hatdrive (pcie gen 2&3) and nvme ssd (gen3); boot from micro sd and data disk moved to nvme ssd. I definitely notice performance improvement but want to make sure its optimally configured. From what I know raspi 5 runs at pcie 2 but can be forced in boot config to use gen 3. Is this possible with HA OS, how? How can I benchmark disk speed?

I tried to enable debugging on 22222 with no luck. So I pulled the sd card and there is no config.txt in hassos-system0 mnt/boot. Does this get moved with data disk to nvme. Do I have to move data back to sd to edit and then back to nvme?

2 Likes

Same here. Also want to know. Or maybe, am I doing this correctly.

Followed this guide to enable SSH to the Operating system.
How to enable SSH on Home Assistant OS
An then connected to it using SSH to port 22222 and the certificate I created.

Once in the OS I from this guide.
How to Set Up and Benchmark Your NVMe on the Raspberry Pi 5
Figured out that I needed to change a setting in

/boot/firmware/config.txt

And after some searching think the corresponding file in Home Assistant OS is

/mnt/boot/config.txt

So in there I appended the following at the end under the “all” stanza

dtparam=pciex1_gen=3

Then I tested a reboot and throughput using the dd command. And the results were strange.
A full reboot (timed by an automation) went from 532 sec to 525 sec, so that can be written off as no change.
Using this dd command, found here.
Test disk read and write speed?

dd if=/dev/sda of=/mnt/data/supervisor/tmp/temp.img bs=8k count=256k

I observed that throughput went from 32.6MB/s to 32.7MB/s so no change there either. I was expecting number in the tenfolds of this

Is this the wrong approach?
Or does Home Assistant OS not read the config.txt from /mnt/boot

you made it further than me. i wish we could get an official answer for this. yea, pcie gen3 can reach 3500MB/s, so should’ve seen an significant increase

1 Like

How did you get your nvme drive to show up? I cant seem to even get my nvme to show up to move my data disk?

My nvme was detected automatically. Could it be a bad ribbon? I’m assuming you tested the nvme drive. My self (if everything been tested), I would full back up ha, flash micro SD with latest ha for rpi5, restore backup during setup, and then attempt data disk migration.

I’m using Crucial P3 1TB PCIe Gen3 - CT1000P3SSD8 with Argon neo 5, and also used with Pineberry hatdrive. They both worked flawless. I’m still waiting for an easier way to force gen3 on rpi5 in haos

Hi, can you tell what username you use for the login on port 22222? I tried root and it doesn’t like that, or pi.

I have the public key setup, just not sure what credentials you’re supposed to use.

Thanks

ssh [email protected] -p 22222

see

1 Like

Hi francisp, I used the SSH 22222 add-on to place my public key, but when I try to login using the cmd you suggested it says denied.

I tried accessing with putty and it asked for a username, root didn’t work, which is where my original question came from.

I’m trying the method you have pointed towards and I’m stuck at the first hurdle… How to create a partition on a usb called CONFIG. All I can find is how to create a primary partition, using diskpart. I’ve been in disk management as well but when I right click on my usb drive most options are greyed out.

I’ll keep looking but if it’s easy and I’m just being a simpleton, I’d welcome a pointer.

Thanks

You could use this

That’s the one I mentioned, yes :+1:

1 Like

is there now a solution for this question? I would also be interested…

after SSH into HA
try this

# dd if=/dev/zero of=/mnt/data/temp.img bs=8k count=256k

my result
262144+0 records in
262144+0 records out
2147483648 bytes (2.0GB) copied, 2.226857 seconds, 919.7MB/s

Initial situation ‘only’ 600MB

So I had installed HA via bootloader and imported my backup. So Internet installation directly on the PI.

I then executed this command:
dd if=/dev/zero of=/mnt/data/temp.img bs=8k count=256k

Result:
➜ ~ dd if=/dev/zero of=/mnt/temp.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.0GB) copied, 3.323903 seconds, 616.1MB

NVME PI shield nvme: Pimoroni PIM699
SSD: Crucial P3 Plus M.2 500GB

Info from pimoroni:
The Raspberry Pi 5 will run at PCIe 3.0 x 1 speeds at best, even though this mode is unsupported officially, so most drives are limited to around 700-800MB/s read and 350-450MB write at peak.

Activation of PCIe 3 → 1000MB

Now I have adapted the config.txt file (Enter at the end after ALL):
dtparam=pciex1_gen=3

Just clicking anywhere on the Homeassistant website has become much faster.
Or the SSH Terminal AddOn is also started much faster. The dashboard now loads without delay.

For a new test you should delete the temp file, otherwise you will get a worse result.

➜ /mnt rm /mnt/temp.img
➜ /mnt dd if=/dev/zero of=/mnt/temp.img bs=8k count=256k
262144+0 records in
262144+0 records out
47483648 bytes (2.0GB) copied, 1.958974 seconds, 1.0GB/s


To be able to change the Config.txt file you have to connect via SSH not via 22 but via 22222.
This is the SSH access to the HomeAssisten operating system level. Attention, you can also break a lot here. It is not the HomeAssistant SSH configuration level that can otherwise be reached via port 22. You should therefore have a backup.

To activate SSH with port 22222, you need a USB stick on the PI. The stick must be FAT32 formatted. This USB stick must be named ‘CONFIG’. An ‘authorised_keys’ file must be created on the USB stick. This file must contain a line with an RSA key. You can create this RSA key via Mac in the Terminal Console. Alternatively via Windows with Putty. The RSA key contains a password assigned by you, which you can use to log in with the root user. A key pair is created by generating it. The counterpart is located on your computer. This means that you can only connect to the device on which you have generated the key. You can store several lines / keys in the file.

Here is a German guide including a video on how this works with SSH. You can see everything important. You just have to do it for Windows or Mac. You don’t have to do both.


The Pi Boot configuration file can be found via SSH port 22222 under mnt/boot/config.txt

nano is not installed by default.
However, you can edit the file via vi editor.

vi mnt/boot/config.txt

vi editor takes some getting used to if you are not familiar with it.

Scroll down to the bottom using the down arrow.
Press ‘p’ to edit.

Write the command under [ALL].

dtparam=pciex1_gen=3

Press ESC to finish editing
Write the three characters :wq for the Save and Close command. Press Enter to execute the command. VI is closed and the change is saved.


Restart the PI as shown in the video and check the speed.
The test can be carried out in the normal SSH port 22.