Lately, for various reasons, I got into using Raspberry Pis, in particular in combination with the GPIO.
What puts me off by a bit is the fact that the regular RPis used (micro) SD cards. While reading from an SD card might not be that bad, but writing to it, over and over again, will destroy over a short period of time. Thereby destroying the data you stored on it.
For my projects, therefore, another solution had to be found.
In this series of posts, I will document my experiences using various methods and devices to avoid the wear and tear of an SD card.
This first episode reflects on using BerryBoot to boot from and load the OS from USB connected devices.
Using and installing BerryBoot is very simple. Download the archive provided in the above mention link. Make sure you picked the file that fits your Raspberry Pi.
During writing this article, it appears that the BerryBoot image now changed to a single archive for all variants of the RPi. I have not tested this, since I just a few hours prior to the writing of this post, downloaded the archive for Pi0 to Pi3+ boards.
Anyway, I stick with what I have and what worked for me earlier.
In my present test, I am using a Raspberry Pi 1 B+ with a 2GB micro-SD card as a boot device and a USB-2 HDD enclosure with a 320GB 3.5" hard-disk. The enclosure came with a 2TB disk, which is used in something else by now.
Further, the enclosure is powered externally by a 12V wall-ward. This, of course, is important, since a Raspberry Pi would never be able to provide the power for any HDD.
Following the procedure as set out on the BerryBoot page, an OS will be written to the USB attached device. I opted for a full install of Raspberry Pi OS, as it is presently called.
After having booted "into" the HDD, the experience is certainly less snappy, compared to running the OS from the SD card. However, the mere difference is storage space should put up some questions: 8GB SD card vs. 320GB HDD.
Initially, no swap space was created. So, I decided for creating a swap-file on the root directory of the hard-drive. That did not work. It appears that under BerryBoot, using a swap file is impossible.
A solution to the missing swap-file is to install zram-tools, which will enable a virtual swap into compressed memory.
In following posts, I will discuss various other options for booting a Raspberry Pi from USB devices.