Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
authorGerardo Exequiel Pozzi <vmlinuz386@gmail.com>2015-01-27 14:37:05 -0300
committerGerardo Exequiel Pozzi <vmlinuz386@gmail.com>2015-01-27 14:37:05 -0300
commitb79eaf302dc387c8ed80fa3d935c069c4576b583 (patch)
tree08fa24a2168c0ec01c65755ce1f1236694856be4 /hooks
parent25dd3aba62f0fe28f76c6a3c2ab1bba3cd479199 (diff)
[archiso] Add optional OverlayFS support
This is the first attemp to test overlayfs in archiso. The current dm-snapshot mode is keep and is enabled by default, while the new mode is enabled via "-s sfs" to mkarchiso. No new boot parameters are added, since archiso hooks detects if the .sfs file is for dm-snapshot (airootfs.img inside) or for overlayfs. Persistence is supported in overlayfs mode using the same options (cowlabel or cowdevice), but warning while in dm-snapshot mode, only one file is used (airootfs.cow), in overlayfs mode internal files for workdir/ and upperdir/ are allocated, so you can not use VFAT or NTFS. To test this, you need to enable [testing] in pacman.conf from releng profile and edit build.sh then add "-s sfs" in make_prepare() Look at: setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare Replace with: setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -s sfs -D "${install_dir}" prepare The build requires just half of space that the build for dm-snapshot, since there is no ext4 img ;) Just to remember: there is no space gain in .sfs (just about 2M) There is at least one thing during boot with machine-id service: Dec 24 03:31:39 archiso systemd-machine-id-commit[183]: Failed to unmount transient /etc/machine-id file in our private namespace: Invalid argument Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
Diffstat (limited to 'hooks')
-rw-r--r--hooks/archiso18
1 files changed, 16 insertions, 2 deletions
diff --git a/hooks/archiso b/hooks/archiso
index 3ef4eb1..9d38f07 100644
--- a/hooks/archiso
+++ b/hooks/archiso
@@ -1,5 +1,5 @@
# args: source, newroot, mountpoint
-_mnt_fs() {
+_mnt_dmsnapshot() {
local img="${1}"
local newroot="${2}"
local mnt="${3}"
@@ -37,6 +37,16 @@ _mnt_fs() {
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/archiso/used_block_devices
}
+# args: source, newroot, mountpoint
+_mnt_overlayfs() {
+ local src="${1}"
+ local newroot="${2}"
+ local mnt="${3}"
+ mkdir -p /run/archiso/cowspace/${cow_directory}/upperdir /run/archiso/cowspace/${cow_directory}/workdir
+ mount -t overlay -o lowerdir=${src},upperdir=/run/archiso/cowspace/${cow_directory}/upperdir,workdir=/run/archiso/cowspace/${cow_directory}/workdir airootfs "${newroot}${mnt}"
+}
+
+
# args: /path/to/image_file, mountpoint
_mnt_sfs() {
local img="${1}"
@@ -165,7 +175,11 @@ archiso_mount_handler() {
mkdir -p "/run/archiso/cowspace/${cow_directory}"
_mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sfs" "/run/archiso/sfs/airootfs"
- _mnt_fs "/run/archiso/sfs/airootfs/airootfs.img" "${newroot}" "/"
+ if [[ -f "/run/archiso/sfs/airootfs/airootfs.img" ]]; then
+ _mnt_dmsnapshot "/run/archiso/sfs/airootfs/airootfs.img" "${newroot}" "/"
+ else
+ _mnt_overlayfs "/run/archiso/sfs/airootfs" "${newroot}" "/"
+ fi
if [[ "${copytoram}" == "y" ]]; then
umount /run/archiso/bootmnt