SD card read-only mode

From Nocrashwiki
Revision as of 15:50, 12 December 2024 by Chris (talk | contribs) (Created page with "Unplugging your Raspberry Pi to shut it down can eventually result in system file corruption. Any operating system stored on an SD card may eventually fail if used for long pe...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Unplugging your Raspberry Pi to shut it down can eventually result in system file corruption. Any operating system stored on an SD card may eventually fail if used for long periods of time. To reduce these risks, you can make your SD card read-only. Open the raspi-config tool with the following command:

$ sudo raspi-config

Navigate through the menu system as follows:

  1. Select Performance options
  2. Select Overlay File System
  3. Confirm that you would like to enable the overlay file system
  4. Confirm that you would like to write-protect the boot partition
  5. Confirm reboot

This whole process may take a few minutes to complete.

If you need to enable access again to carry out an update or adjust your scripts, SSH back into your Raspberry Pi and run this command to allow write access temporarily:

$ sudo mount -o remount,rw /boot

You can now carry out any work required. Another reboot will revert your SD card to a read-only state.