All Projects → nils-werner → Raspi Overlayroot

nils-werner / Raspi Overlayroot

Licence: mit
Protect your SD card against wear and tear

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Raspi Overlayroot

Raspberry Pi Setup Guide
A really opionionated guide how to setup a Raspberry Pi 4 with Arch Linux including WiringPi, NTP, Wi-Fi, SSH, Ruby (asdf), ZSH and more.
Stars: ✭ 286 (+333.33%)
Mutual labels:  raspberry-pi, arch-linux
arch-btrfs-install-guide
Arch Linux installation guide with btrfs and snapper, this guide is based on the information from unicks.eu guide https://www.youtube.com/watch?v=TKdZiCTh3EM, and Arch Linux UEFI step-by-step installation guide https://www.youtube.com/watch?v=dOXYZ8hKdmc from ALU.
Stars: ✭ 32 (-51.52%)
Mutual labels:  filesystem, arch-linux
Nnn
n³ The unorthodox terminal file manager
Stars: ✭ 13,138 (+19806.06%)
Mutual labels:  raspberry-pi, filesystem
Archstrike
An Arch Linux repository for security professionals and enthusiasts. Done the Arch Way and optimized for i686, x86_64, ARMv6, ARMv7 and ARMv8.
Stars: ✭ 401 (+507.58%)
Mutual labels:  raspberry-pi, arch-linux
Avalonstudio
Cross platform IDE and Shell
Stars: ✭ 1,132 (+1615.15%)
Mutual labels:  arch-linux
Yubikey Full Disk Encryption Secure Boot Uefi
Tutorial to create full disk encryption with YubiKey, encrypted boot partition and secure boot with UEFI
Stars: ✭ 62 (-6.06%)
Mutual labels:  arch-linux
Nvidia System Monitor Qt
Task Manager for Linux for Nvidia graphics cards
Stars: ✭ 61 (-7.58%)
Mutual labels:  arch-linux
Libgps
UART NMEA GPS library for Raspberry Pi
Stars: ✭ 60 (-9.09%)
Mutual labels:  raspberry-pi
Ultimatemrz Sdk
Machine-readable zone/travel document (MRZ / MRTD) detector and recognizer using deep learning
Stars: ✭ 66 (+0%)
Mutual labels:  raspberry-pi
Raspberry Gpio Manager
A basic library to manage the GPIO pins on a Raspberry Pi with C Sharp.
Stars: ✭ 65 (-1.52%)
Mutual labels:  raspberry-pi
Q3lite
Q3lite, an OpenGL ES port of Quake III Arena for embedded Linux systems.
Stars: ✭ 64 (-3.03%)
Mutual labels:  raspberry-pi
Qdomyos Zwift
Zwift bridge for smart treadmills and bike/cyclette
Stars: ✭ 63 (-4.55%)
Mutual labels:  raspberry-pi
Simplefs
A simple file system for Linux kernel
Stars: ✭ 65 (-1.52%)
Mutual labels:  filesystem
Ip Kvm Interface
DIY IP-KVM for Remote Desktop Access
Stars: ✭ 62 (-6.06%)
Mutual labels:  raspberry-pi
Guitar
Git GUI Client
Stars: ✭ 1,136 (+1621.21%)
Mutual labels:  raspberry-pi
Instant Archlinux On Mac
Instant Arch Linux on Mac & MacBook
Stars: ✭ 61 (-7.58%)
Mutual labels:  arch-linux
Openvoiceos
OpenVoiceOS is a minimalistic linux OS bringing the open source voice assistant Mycroft A.I. to embbeded, low-spec headless and/or small (touch)screen devices.
Stars: ✭ 64 (-3.03%)
Mutual labels:  raspberry-pi
Os Rootfs
The root filesystem of HypriotOS
Stars: ✭ 65 (-1.52%)
Mutual labels:  raspberry-pi
Notify
🔭 Cross-platform filesystem notification library for Rust.
Stars: ✭ 1,123 (+1601.52%)
Mutual labels:  filesystem
Hcxtools
Portable (that doesn't include proprietary/commercial operating systems) solution for conversion of cap/pcap/pcapng (gz compressed) WiFi dump files to hashcat formats (recommended by hashcat) and to John the Ripper formats. hcx: h = hash, c = convert and calculate candidates, x = different hashtypes
Stars: ✭ 1,121 (+1598.48%)
Mutual labels:  raspberry-pi

overlayroot for ArchLinux ARM

Mounts an overlay filesystem over the root filesystem, so you can run without losing data on powerloss or wearing out your SD cards. Similar to fsprotect on Debian.

Build Status

Background

Most common Linux installations require large parts of the root fileystem to be writable to run services reliably: Logging services create logfiles, other services create temporary config files, some services need a cache they can write to.

However, SD cards like the ones used with Raspberry Pis don't like constantly being written to. They wear out and start to show errors after a few months or years of constantly being written to.

So what one needs in this situation is a file system that can be read-only on the hardware side, but read-write on the operating system side.

OverlayFS can do exactly that: by layering several file systems one can show data from one (the 'lower') filesystem, but have all changes to the data end up in a different (the 'upper') file system. If the lower filesystem is our SD card and the upper filesystem is a temporary filesystem in RAM, we have effectively separated our SD card from all write-attempts of the operating system. Without the operating system even noticing.

If we even mounted the lower filesystem as readonly, it also becomes 100% tolerant to power-losses. You can simply pull the plug to power down your Raspberry Pi.

Using this method I have been running several Raspberry Pi computers for 3+ years nonstop, after which the power supply gave way and had to be replaced. The SD-Card however is still working.

Installation

Package

Install this package

makepkg -si

Then try rebooting, it should boot as normal.

Enable overlayroot hook

Then in /etc/mkinitcpio.conf

  1. add overlay to your MODULES array
  2. add overlayroot to your HOOKS array

and rebuild the initramfs by running

mkinitcpio -P

and reboot. It should boot as normal.

Enable overlayroot in commandline

With the initramfs in place, you can now enable overlayroot by adding overlayroot to the end of the Kernel commandline

I.e. for Raspberry Pi, edit /boot/cmdline.txt

root=/dev/mmcblk0p2 rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop overlayroot

and reboot. You should see a warning during login that any changes you make to your filesystem will be non-persistent after this point.

Set filesystems readonly

You can now also set the entire root filesystem as readonly by changing rw to ro in the Kernel commandline

I.e. for Raspberry Pi

root=/dev/mmcblk0p2 ro rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop overlayroot

and adding ro to /etc/fstab

#
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
/dev/mmcblk0p1  /boot   vfat    defaults,ro     0       0

Editing the root filesystem

You can run rwrootfs to remount all file systems as read-write and change into an interactive shell in your SD card file system. After exiting that shell, the fileystems will remain read-write until next reboot.

Alternatively you can undo all changes from Enable overlayroot in commandline and Set filesystems readonly and reboot. This is the recommended way of system upgrades.

Debugging

Sometimes, overlayroot may cause trouble during boot time. To boot without it simply remove overlayroot from /boot/cmdline.txt.

If you still have problems, you can also try removing the initramfs by removing

initramfs initramfs-linux.img followkernel

from /boot/config.txt.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].