Source: live-boot
Version: 1:20170623
Severity: normal
Tags: patch

Hi,

Resizing the upperdir tmpfs mount will not affect mounted overlays.
The tmpfs size must be configured when mounting it. Therefore please add
a overlay-size configuration option. A tested patch is attached.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg
>From 7735def74f55c617ee7f82f6c540f15e2e8adee7 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Fri, 22 Dec 2017 12:34:20 +0100
Subject: [PATCH] Support setting upperdir tmpfs mount point size

Resizing the upperdir tmpfs mount will not affect mounted overlays.
The tmpfs size must be configured when mounting it. Therefore add a
overlay-size configuration option.

Signed-off-by: Benjamin Drung <benjamin.dr...@profitbricks.com>
---
 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..00dd6a9 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.14.1

Reply via email to