Minecraft: Raspberry Pi 5
I decided to upgrade my Minecraft server to a Raspberry Pi 5 to see if I can get better performance, especially when creating new “chunks” (new terrain).
Originally, I was just going to swap over the USB3 SSD but after some reading, it appears I can get better drive speed with the new PCI interface to an NVME drive. There is a convenient “base” from Pimoroni the attaches the drive under the main RPi motherboard. This is much cleaner that having the USB drive hanging off the Raspberry Pi.
Now I will have two operational servers and can do some performance comparisons.
I need to figure out how to make the Pi boot from the NVME. It is supposed to work. (My immediate concern is “does the NVME board I bought work?”)
I used the Raspberry Pi Image creator to temporarily install the OS on an SD card. Once it booted, I was able to confirm the NVME drive was recognized with “lsblk”:
tompayne@rpi5:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk0 179:0 0 29.8G 0 disk
├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware
└─mmcblk0p2 179:2 0 29.3G 0 part /
nvme0n1 259:0 0 238.5G 0 disk
The drive shows up here as “nvme0n1”
To check the performance, I installed and used “hdparm”:
tompayne@rpi5:~ $ sudo hdparm -t --direct /dev/nvme0n1
/dev/nvme0n1:
Timing O_DIRECT disk reads: 1174 MB in 3.00 seconds = 390.94 MB/sec
The drive/chip I bought (Inland TN320 256GB SSD) claims to support 2000 MB/sec read and 1500 MB/sec right. I am thinking the system id defaulting to PCI Gen 2 speeds. In the videos I have found, it says to tweak the /boot/config.txt file changing dtparam=pciex1_gen=3 but in my version of the OS, the confix.txt file has been moved to /boot/firmware/config.txt and does not include any reference to the dtparam setting.
Based on uname and /etc/os-release, I am running:
- System: 64-bit (
aarch64
inuname
) - Kernel version: 6.6 (specifically
6.6.31
inuname
) - Debian version: 12 (bookworm)
- Release date: July 4, 2024
It appears this is now in the Advance section of raspi-config. After changing to PCI Gen 3, I am getting faster performance:
tompayne@rpi5:~ $ sudo hdparm -t --direct /dev/nvme0n1
/dev/nvme0n1:
Timing O_DIRECT disk reads: 2282 MB in 3.00 seconds = 760.51 MB/sec
To copy the OS from the SD Card to the NVME, I will use rpi-clone base on the suggestion of Jeff Geerling. First I need to install git (sudo apt install git
) , because Jeff suggests using a fork.
# Install rpi-clone.
git clone https://github.com/geerlingguy/rpi-clone.git
cd rpi-clone
sudo cp rpi-clone rpi-clone-setup /usr/local/sbin
# Clone to the NVMe drive (usually nvme0n1, but check with `lsblk`).
sudo rpi-clone nvme0n1
The first time I tried the rpi-clone, it failed. ChatGTP suggested I try manually formatting the drive first:
sudo mkfs.vfat -F 32 /dev/nvme0n1p1
sudo mkfs.ext4 /dev/nvme0n1p2
I re-executed the rpi-clone and it appeared to work.
The boot order is now part of raspi-config as well. After changing the setting, I pulled out the SD Card and cycled power and the RPi5 booted up successfully from the NVME drive. Yeah!
Next I need to set up James A Chamber’s Docker Container, but first you need to install docker. I thought it was as simple as “sudo apt install docker”, but that didn’t work. I forgot I followed the instructions from my other go-to site, Pi My Life Up.