Skip to content

Commit ca1c9e5

Browse files
committed
polish and add
1 parent dd35d00 commit ca1c9e5

1 file changed

Lines changed: 34 additions & 7 deletions

File tree

README.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
mounts an overlay filesystem over the root filesystem
33

44
I use this for my Raspberry Pi, but it should work on any Debian or derivative.
5-
It uses initramfs. Stock Raspbian doesn't use one so step one would be to get initramfs working. Something like:
5+
6+
The root file system on the sd-card is mounted read-only on /overlay/lower, and / is a
7+
read-write copy on write overlay.
8+
9+
It uses initramfs. Stock Raspbian doesn't use one so step one would be to get initramfs working.
10+
Something like:
611

712
```bash
813
sudo mkinitramfs -o /boot/init.gz
@@ -42,17 +47,39 @@ if [ ! -z "${IMCHROOTED}" ]; then
4247
PS1="chroot(${IMCHROOTED})\w:# "
4348
fi
4449
```
45-
I use rootwork to work on the real root filesystem.
46-
I put it in ~/bin and add ~/bin to my path
47-
48-
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
4950

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

55-
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.
58+
You're now making changes to the sdcard, and changes will be permanent.
59+
60+
I use `rootwork` to work on the real root filesystem.
61+
I put it in ~/bin and add ~/bin to my path.
62+
63+
The /run directory is problematic to umount, so atm `rootwork` --rbind mounts it
64+
on the sd-card root file system, /overlay/lower, and it isn't umounted like /boot
65+
/proc /sys and /dev are.
66+
67+
After you've finished working on the sd-card run `exit`. `rootwork` tries to clean up
68+
by umounting all the mounts it mounted and remount /overlay/lower read-only, but
69+
often it can't due to an open file or something else causing the filesystem to be busy.
70+
It's probably a good idea to reboot now for 2 reasons:
71+
72+
- leaving /overlay/lower read-write could cause file corruption on power loss.
73+
- to test it still boots ok after the changes you've just made.
74+
75+
Whenever the kernel is updated you need to rerun
76+
77+
```bash
78+
sudo mkinitramfs -o /boot/init.gz
79+
```
80+
81+
TODO: see if there's a hook to automatically run `sudo mkinitramfs -o /boot/init.gz`
82+
on kernel install
5683

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

0 commit comments

Comments
 (0)