Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
111 lines (69 sloc) 2.95 KB
#!/bin/bash
build() {
local mod
for mod in aufs squashfs loop; do
add_module "$mod"
done
add_runscript
}
help() {
cat <<HELPEOF
This hook enables booting from an aufs root filesystem.
It requires the "aufs" module.
It's loosely based on the archiso hook, with ideas from livecds & the ubuntu hook with the same name.
SETUP
-----
- install the aufs3 module
- add "fsck rootaufs" to HOOKS in /etc/mkinitcpio.conf
- setup a boot entry with the appropriate options, "rootaufs" being the minimum
USAGE
-----
boot options:
- rootaufs[=path]:
required to enable the hook, allows to specify the RW filesystem
by default mounts a tmpfs filesystem
if "path" is specified and is a block device or disk image, mounts that instead
*WARNING*: the FS specified here WILL be modified, so use carefully
- overlay=path1[,path2,pathN]:
optional, allows to specfiy RO filesystems to overlay
as with rootaufs, pathX can be either a block device or disk image
multiple paths can be specfied separated by comas, each one will be stacked under the RW file system in order (from bottom to top)
- roothide:
do NOT add the real root FS at the bottom of the aufs stack
by default the boot root filesystem is added as the base of the aufs stack
this option prevents this behavior
userland created at boot time:
- /aufs:
this dir contains the mount points of the individual filesystems composing the root aufs:
* the real root is mounted as "root"
* the RW fs is mounted as "rw"
* overlayed fs are mounted as their basename
- remountr[wo]:
scripts to remount the (real) root rw/ro
EXAMPLES
--------
boot options:
<kernel cmd> rootaufs
use real root as RO base, add a tmpfs RW on top
used for example to test some modifications without altering the real fs
<kernel cmd> rootaufs=/dev/sdb1
same as above, but write to a filesystem on /dev/sdb1
<kernel cmd> rootaufs=/test/ext2.img
same as above, but write to a filesystem in the disk image /test/ext2.img
<kernel cmd> rootaufs=/test/ext2.img overlay=/test/root.squash roothide
use the squashfs file /test/root.squash RO base, hide the real root and write to /test/ext2.img
used for "persisent live cd" type setups, reducing the footprint of the root filesystem while allowing modifications to persist
prepare a formatted disk image:
# truncate -s 2G /test/ext2.img
# losetup /dev/loop0 /test/ext2.img
# mkfs.ext2 /test/ext2.img
make a squashfs root fs (requires squashfs-tools):
# mksquashfs /test/root.squash /mnt/arch-base
WARNINGS
--------
This hook can potentially harm your system, so use carefully and make sure you have a recent backup before trying new things.
While adding the "fsck" hook to mkinicpio will ensure validation of the root filesystem, other fs may not be checked. Manual fsck may be required in case of unclean shutdown.
It is pretty experimental software and contains bugs and missing features.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et: