Like I said in my previous post, I run all my Smart Home applications in a small Raspberry Pi5 in our electricity cabinet. It runs really fine, I have no gripe with the speed. But what I am wary of, is the SD-card corrupting.
After investing into the Raspberry Pi, I of course did my deed and googled the heck out of everything, and the most common problem? SD-Card corrupting and shutting down the whole system. Now as my Smart Home has to run flawlessly 100% of the time, this was not an option.
So before I even ordered the Raspberry Pi, I made sure that there would be some kind of an upgrade path to a more stable storage system. And there was, there was a PCIe -port I could use to install a NVMe M.2 HAT to upgrade the whole system to a SSD-media.
Raspberry themselves, promised NVMe M.2 HAT at the beginning of the year, but that never happened, but luckily, around february-march, other companies started to bring compatible HAT’s. And Raspberry themselves, have updated their EEPROM quite often with support for NVMe -drives.
But what I did was order myselves Geekworm X1003 HAT, since I had one rule, it needed to fit into the original case. I wanted the nifty Raspberry Pi case since I kinda liked how it looked, and I liked how it fit into my electricity cabinet.
Time to Hardware
So after everything was mailed to me, time to run the show, with too little pictures between, sorry about that!
- Upgrade my heatsink
- Remove the Original Case Fan.
- Add Geekworm NVMe HAT as instructed https://wiki.geekworm.com/X1003
Then boot up from SD card, and do some magic. First things first, I bought Makerdisk NVMe drive, which was 128GB, it was relatively cheap, I knew 100% it would work (there have been some incompatible NVMe drives around), and the size was enough.
Time to Software
First things first, clean up the original NVMe drive so it’s empty:
# Unmount all existing partitions
sudo umount /dev/nvme0n1p1
sudo umount /dev/nvme0n1p2
# Wipe all partitions
sudo wipefs --all --force /dev/nvme0n1p1
sudo wipefs --all --force /dev/nvme0n1p2
sudo wipefs --all --force /dev/nvme0n1
# Empty the whole nvme drive
sudo dd if=/dev/zero of=/dev/nvme0n1 bs=1024 count=1
Now before cloning my system, I did my fair share of what was the best way of going around to accomplish it. The best option would have been to mount both the SD-card and NVMe-drive into my laptop, and clone it there. But since I didn’t have a M.2 adapter, I opted to use rpi-clone. Which almost everyone suggested.
Before doing this, I manually made sure I had shutdown all my docker images, shutdown all running hosted software. So that there would be as little of interference coming, from cloning a running system.
# 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
sudo rpi-clone nvme0n1
Then I just rebooted the system, remove the SD-card, toss it into my cabinet as backup option, and be happy. And then did some write/read tests which I’ve pasted below.
Time to Measure
SD
Write 13,4 MB/s
Read 90,8 MB/s
SSD
Write 544 MB/s
Read 842 MB/s
So, after all this, did I actually notice any difference, any speed up? Honestly, no. Everything that was running, was fast enough already.
But I think this gives me some peace of mind and some reliability in the long run for years to come. And at least, when upgrading docker packages or linux packages, it’s not about the I/O -speed anymore how fast apt/docker can fetch new packages and update them.