Skip to content

Commit

Permalink
polish and add
Browse files Browse the repository at this point in the history
  • Loading branch information
chesty committed Mar 10, 2019
1 parent dd35d00 commit ca1c9e5
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
mounts an overlay filesystem over the root filesystem

I use this for my Raspberry Pi, but it should work on any Debian or derivative.
It uses initramfs. Stock Raspbian doesn't use one so step one would be to get initramfs working. Something like:

The root file system on the sd-card is mounted read-only on /overlay/lower, and / is a
read-write copy on write overlay.

It uses initramfs. Stock Raspbian doesn't use one so step one would be to get initramfs working.
Something like:

```bash
sudo mkinitramfs -o /boot/init.gz
Expand Down Expand Up @@ -42,17 +47,39 @@ if [ ! -z "${IMCHROOTED}" ]; then
PS1="chroot(${IMCHROOTED})\w:# "
fi
```
I use rootwork to work on the real root filesystem.
I put it in ~/bin and add ~/bin to my path

After rebooting, the root filesystem should be an overlay. If it's on tmpfs any changes made will be lost after a reboot. If you want to upgrade packages, for example, run `rootwork`, the prompt should change to

After rebooting, the root filesystem should be an overlay. If it's on tmpfs any changes
made will be lost after a reboot. If you want to upgrade packages, for example,
run `rootwork`, the prompt should change to
```bash
chroot(/overlay/lower)/:#
```
You're now making changes to the sdcard, and changes will be permanent.

After you've finished working on the sdcard run `exit`. rootwork tries to clean up by umounting all the mounts it mounted, but often it can't umount a filesystem due to a lock file or something else causing the filesystem to be busy. It's probably a good idea to reboot now for 2 reasons, 1 to clear the mounts that couldn't be umounted, and also to test it still boots ok after the changes you've just made.
You're now making changes to the sdcard, and changes will be permanent.

I use `rootwork` to work on the real root filesystem.
I put it in ~/bin and add ~/bin to my path.

The /run directory is problematic to umount, so atm `rootwork` --rbind mounts it
on the sd-card root file system, /overlay/lower, and it isn't umounted like /boot
/proc /sys and /dev are.

After you've finished working on the sd-card run `exit`. `rootwork` tries to clean up
by umounting all the mounts it mounted and remount /overlay/lower read-only, but
often it can't due to an open file or something else causing the filesystem to be busy.
It's probably a good idea to reboot now for 2 reasons:

- leaving /overlay/lower read-write could cause file corruption on power loss.
- to test it still boots ok after the changes you've just made.

Whenever the kernel is updated you need to rerun

```bash
sudo mkinitramfs -o /boot/init.gz
```

TODO: see if there's a hook to automatically run `sudo mkinitramfs -o /boot/init.gz`
on kernel install

There are comments in some of the files you might want to read
and that's about it.

0 comments on commit ca1c9e5

Please sign in to comment.