From 41611e087d9be36c3eb8526e8cce715a47aca9ca Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Fri, 22 Dec 2017 12:34:20 +0100 Subject: [PATCH] Support setting upperdir tmpfs size with overlay-size boot parameter Resizing the upperdir tmpfs mount will not affect mounted overlays. The tmpfs size must be configured when mounting it. Therefore add an overlay-size configuration option. Signed-off-by: Benjamin Drung Closes: #885466 --- components/9990-cmdline-old | 5 +++++ components/9990-overlay.sh | 4 ++-- manpages/en/live-boot.7 | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/9990-cmdline-old b/components/9990-cmdline-old index a565ce1..03e8fc6 100755 --- a/components/9990-cmdline-old +++ b/components/9990-cmdline-old @@ -161,6 +161,11 @@ Cmdline_old () ramdisk_size="${_PARAMETER#ramdisk-size=}" ;; + overlay-size=*) + OVERLAY_SIZE="${_PARAMETER#overlay-size=}" + export OVERLAY_SIZE + ;; + persistence) PERSISTENCE="true" export PERSISTENCE diff --git a/components/9990-overlay.sh b/components/9990-overlay.sh index 8fd0cfd..db6a44e 100755 --- a/components/9990-overlay.sh +++ b/components/9990-overlay.sh @@ -240,12 +240,12 @@ setup_unionfs () then cowdevice="tmpfs" cow_fstype="tmpfs" - cow_mountopt="rw,noatime,mode=755" + cow_mountopt="rw,noatime,mode=755,size=${OVERLAY_SIZE:-50%}" fi if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ] then - mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/live/overlay" + mount -t tmpfs -o rw,noatime,mode=755,size=${OVERLAY_SIZE:-50%} tmpfs "/live/overlay" root_backing="/live/persistence/$(basename ${cowdevice})-root" mkdir -p ${root_backing} else diff --git a/manpages/en/live-boot.7 b/manpages/en/live-boot.7 index 72184cc..db36641 100644 --- a/manpages/en/live-boot.7 +++ b/manpages/en/live-boot.7 @@ -104,6 +104,8 @@ disables the "persistence" feature, useful if the bootloader (like syslinux) has Do not prompt to eject the live medium. .IP "\fBramdisk\-size\fR" 4 This parameter defines a custom ramdisk size (it's the '\-o size' option of tmpfs mount). By default, there is no ramdisk size set, so the default of mount applies (currently 50% of available RAM). Note that this option has currently no effect when booting with toram. +.IP "\fBoverlay\-size\fR=\fISIZE\fR" 4 +The size of the tmpfs mount (used for the upperdir union root mount) in bytes, and rounded up to entire pages. This option accepts a suffix % to limit the instance to that percentage of your physical RAM or a suffix k, m or g for Ki, Mi, Gi (binary kilo (kibi), binary mega (mebi) and binary giga (gibi)). By default, 50% of available RAM will be used. .IP "\fBswap=true\fR" 4 This parameter enables usage of local swap partitions. .IP "\fBpersistence\fR" 4 -- 2.1.4