I have been running openHAB for about 2 years and have suffered 2 SD card failures. The first card lasted about 14 months and the next only about 7 months or so. During these situations I got burned a bit with backup/restore and so I decided to install on a SSD hard drive for better reliability.
I am currently documenting the process for installing latest openhabian image onto a USB drive and set my Raspberry Pi 3b to boot from USB. (Without needing to use a card in the sd card slot (not even for /boot)
- Main Computer - Linux - Ubuntu (or you can use Windows and Putty to execute commands over ssh)
- Hardware running openhab2 (Raspberry Pi 3b)
Pre step: . From main computer, use ETCHER to flash latest openhabian image to micro SD card and follow initial setup. ssh into raspberry pi (can watch the install) - You can skip this step if you already have access to the running raspberryPi…
First, check status of current value for option to boot_From_USB in the OTP (one-time programmable memory) of the pi.
openhabian@openHABianPi:~$ vcgencmd otp_dump | grep 17:
The goal is to see a value of: 17:3020000a If you see this value, you can skip the next steps (your Pi already has this set and will attempt to boot from USB in the absence of sd card)
To enable USB boot mode, type the following:
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
This adds program_usb_boot_mode=1 to the end of /boot/config.txt.
Reboot the Raspberry Pi:
sudo reboot now
Once the Pi boots, it will read the new line from the /boot/config.txt file and enable the BOOT_FROM_USB option in the OTP memory. We should now see a value of 17:3020000a if set successfully, we can check again with the code:
$ vcgencmd otp_dump | grep 17:
You should see the new value of 17:3020000a which means the rpi will now check USB slots for bootable medium if one is not found in the memory card slot. (This is a permanent setting). You can now remove the last line from your /boot/config.txt file which we set above. (program_usb_boot_mode=1)
We can now shut down the raspberry pi and remove the SD card and insert our USB stick which has a new image of openhabian flashed using ETCHER.
sudo shutdown now
Remove SD card and plug in your USB now. unplug and re-plug the power adapter to your Pi. This initiate the first time boot from the USB stick or SSD drive.
After about 30 seconds you can watch the installation over ssh from your host computer by logging into the pi with:
(default pass = openhabian) where x.x.x.x is the local IP address of your raspberry pi. This setup will take about 30-60 minutes.
Update: Dec 26th. Shortly after writing this, I decided to use a 240GB SSD. I followed the same process above and had absolutely no trouble. I used a powered USB adapter (as suggested below) with my drive inside the enclosure. This has been working great for a couple of weeks.
I hope you find this helpful.
Raspberry Pi 3- Configure to boot from USB via OTP
Be sure to use a fast USB stick…(or better, use a Solid State Hard Drive - SSD)
I tried to follow this using a USB stick and it took over 2 hours and then finally failed on one of the last steps (updating openhab to latest stable). It seems to be writing much slower and I decided to abort… I came across a website with benchmark results… tuns out this one get a “terrible average bench” … I am using a 64GB Kingston DataTraveler 100 G3… So take note, and you may want to find a faster card!