Support setting upperdir tmpfs size with overlay-size boot parameter
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Fri, 22 Dec 2017 11:34:20 +0000 (12:34 +0100)
committerRaphaël Hertzog <hertzog@debian.org>
Fri, 23 Feb 2018 17:17:46 +0000 (18:17 +0100)
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 <benjamin.drung@profitbricks.com>
Closes: #885466

components/9990-cmdline-old
components/9990-overlay.sh
manpages/en/live-boot.7

index a565ce1..03e8fc6 100755 (executable)
@@ -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
index 8fd0cfd..db6a44e 100755 (executable)
@@ -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
index 72184cc..db36641 100644 (file)
@@ -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