• Stars
    star
    117
  • Rank 301,828 (Top 6 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Protect your SD card against wear and tear

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.

More Repositories

1

zget

Filename based peer to peer file transfer
Python
483
star
2

crestic

Configurable Restic Wrapper
Python
107
star
3

owm-display

brightsky.dev display
JavaScript
69
star
4

mdct

A fast MDCT implementation using SciPy and FFTs
Python
50
star
5

stft

Spectrogram calculation for NumPy
Python
44
star
6

pymushra

pyMUSHRA is a python web application which hosts webMUSHRA experiments and collects the data with python.
Python
35
star
7

pymf

Python Matrix Factorization Module
Python
32
star
8

raspi-dashboard

Arch Linux based fullscreen web display
Shell
28
star
9

Typewriter

Unique Markdown editor for WebOS
JavaScript
22
star
10

python-go-cffi

Python to Go bindings using CFFI
Python
18
star
11

lastfm-albums

A generator for album art badges from your Last.fm stats
PHP
16
star
12

xbmc-somafm

SomaFM Plugin for XBMC
Python
13
star
13

dump_db

A database dumper for Symphony CMS
PHP
11
star
14

airdroppy

A browser based peer-to-peer file transfer proxy written in Python
Python
8
star
15

less_compiler

LESS Compiler for Symphony CMS
PHP
8
star
16

XSLTproc

XSLTproc integration for TextMate
JavaScript
8
star
17

Bugaroo

A Symphony CMS powered bugtracker
PHP
8
star
18

dont_drop

Hides single Section Navigation Group dropdown-menus
PHP
7
star
19

beta_ntf

Nonnegative Matrix and Tensor Factorization in Python
Python
7
star
20

readonly_mode

Readonly Mode for Symphony CMS
PHP
6
star
21

xslresourceloader

Lets you define resources to load directly in your XSL
PHP
5
star
22

dspy

Digital Signal Processing tools for Python
Python
4
star
23

noediting

Filter to prevent users from editing entries from frontend forms.
PHP
4
star
24

wavplot

Soundcloud plots for everyone
Python
4
star
25

SIP-Notifier

A tiny SIP client to notify of incoming calls
C#
4
star
26

sass_compiler

A SASS compiler for Symphony CMS
PHP
3
star
27

Computergraphics

just some homework we need to do
C
3
star
28

rir-generator.rs

RIR Generator in Rust
Rust
3
star
29

laravel-scaffold

Model-independent scaffolding for Laravel 4
PHP
3
star
30

Showdown

A JavaScript based Markdown parser
JavaScript
2
star
31

twofa

A simple command-line 2-factor authentication token manager
Python
2
star
32

admin_rainbow_headline

Symphony Admin Rainbow Headline Extension
PHP
2
star
33

beancount-paypal

PayPal Importer for Beancount
Python
2
star
34

mobile_phone_backend

Mobile phone related backend improvements for Symphony
PHP
1
star
35

gnome3-candythief

Gnome 3 extension that removes overly candy-like buttons
JavaScript
1
star
36

Dribbzine

JavaScript
1
star
37

joe-sh

joe implemented as shell functions
Shell
1
star
38

headunit-desktop-pkgbuild

Shell
1
star
39

version_info

This extension is DEPRECATED as recent versions of Symphony display the version number themselves.
PHP
1
star
40

pplt

Python
1
star
41

ftm-python

Python
1
star
42

Symposium-2011

My presentations at the Symphony CMS Symposium 2011 in Cologne
JavaScript
1
star
43

vue-mushra

1
star
44

alerts

A stupid extension that displays a lot of alert messages.
PHP
1
star
45

pycell

A Hydrogen code cell executor
Python
1
star
46

enable_tabkey

Enables tab-indentation in code-editors
JavaScript
1
star
47

x264

Mirror of the x264 implementation
C
1
star