The final touch on a project, video loopers, kiosks, multi-use terminals and educators managing a classroom full of Raspberry Pi boards are all perfect scenarios for Read-Only system.

Transcript

What do you do when you finish the Raspberry Pi project and you want to protect it from power cycling? Setting up your system to read-only may be the solution for you.

Today we're going to set up a Raspberry Pi to run read-only, making it revert to your preferred configuration after every reboot. This is going to be a perfect solution for creating permanent digital signage and video loopers, information kiosks, multiple user work terminals and for educators managing a classroom full of Raspberry Pi boards.

There are going to be some concessions. Once you have turned your Raspberry Pi into read-only, no changes, be it writing new code, changing files, deleting directories, are going to be remembered after a reboot. For instance, if you create a new directory on a read-only Raspberry Pi, when it restarts, that directory will have disappeared. However, data can be pulled from a read-only Raspberry Pi via a USB or in any other normal way.

So with your Raspberry Pi set up just like this, and all your settings and data exactly how you want, let's effectively take a permanent snapshot of this moment. And whenever the system gets rebooted, it's going to revert back to this snapshot. And we're going to be able to do this by turning the Raspberry Pi to read-only. But first, for real, back up that microSD card.

With Raspberry Pi OS displaying like normal, open up a new terminal using the black button at the top left of the screen. From here on out, it's going to be the exact same process if you're accessing the Raspberry Pi headlessly or directly. Link down below all about headlessly accessing Raspberry Pis if you need.

In this new terminal, type and enterThe following is the transcript formatted into paragraphs:

The following sudo raspi-config. This line starts with sudo, which means it's going to run the following with admin privileges. As soon as you press enter on this, it's going to open up the configuration menu of the Raspberry Pi.

For today, we're going to navigate down to performance options and press enter. This is going to take us a layer deeper into the menu. In this page, we're going to navigate down to the overlay file system. This is where you're going to be able to enable or disable the read-only file system. And here you can see it's going to ask you, would you like the overlay file system to be enabled? And here we're going to say yes.

Having done this, you're going to see two things happen, one after each other. First, it's going to bounce back to the black terminal for around 30 seconds to update the normal root files. After it's done this, the terminal will display the message, the overlay file system is enabled.

After pressing enter on that screen, it's going to show you a new message asking you if you would like the boot partition to be write-protected. Here, you're going to make sure to say yes as this boot partition, which is the microSD card, is going to be write-protected. If the disk is write-protected, then it is read-only and that is exactly what we want to have happen.

Thus, having pressed enter on yes and rebooting the system, your Raspberry Pi is now completely in read-only mode. I'm going to demonstrate exactly what this means. I'm going to create a new folder on the desktop called, in this example, new folder.

Right now, the microSD card is in read-only, but I can still create folders and files, no problem. I can evenPut these newly created files onto my USB stick and take them away with me. Just because it's read-only doesn't mean you can't alter and create new files. They're just not going to be saved upon a reboot.

CronTab, which is a method of getting software to run on boot, and time synchronization, which is pulling the time information from the internet, are also going to work perfectly with a read-only Raspberry Pi.

I am also going to delete this file here, which I created before making this system read-only. So, let's power cycle the system directly and let's see what happens. Oh, scandalous. It felt naughty.

Knowing that the setup is read-only, we would expect after a reboot that the new folder is going to disappear and that the deleted file is going to come back. And once the setup reboots, we can see that this is exactly what has happened.

Kiosk applications and digital signage are often not properly shut down, but instead simply unplugged at the end of the day. The same goes for video looping machines. Repeating this in the mid to long run is what eventually causes your SD card to corrupt.

Another scenario where you'd want a read-only Pi is when you have a fully completed project and you want it to be both reliable and power cycled via, say, an external timer.

And to those who say my project doesn't even write any data, it is true that your application or program does not write any data, but your operating system, the Raspberry Pi OS or the GUI such as Chromium or the Firefox browser certainly is. Constantly during operation, they'll be writing temporary files, log files, cache files, all kinds. There's a lot going on in these remarkable devices.You can reverse this process nicely and easily, but it's going to require two reboots. Simply, you can go through the same process to revert your Raspberry Pi from read-only back to the default read and write.

The overlay file setting acts as a toggle, so once navigating back to this setting using the Raspberry Pi configuration menu like before, you can simply toggle right on and off. Remember though it's going to take a reboot to disable the overlay file system and then another reboot for the boot partition to become enabled.

Each reboot gives the setting a chance to stick, so make sure not to do any important work until your system is read and write, lest your data is lost. Worth noting, another method to turn the Raspberry Pi OS to read and write is simply done by doing a hard reset and reflashing that microSD card.

Now, hopefully, this well-hidden setting will come in use for you, either by providing your project that finishing touch of security or making your life with Raspberry Pis even easier. So with that, until next time, stay cozy.

Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.