aboutsummaryrefslogtreecommitdiffstats
path: root/stage1
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-06-27 01:49:16 +0200
committerSven Gothel <[email protected]>2021-06-27 01:49:16 +0200
commita443290ad031dc3522f78153a41b3e7a12dc217a (patch)
tree011064d1519903fe04a99c81b5027bd339b9a438 /stage1
parentc2197734f2273c484d9169b7fe824349a6885e67 (diff)
Replace `dphys-swapfile` with static 200MB `/data/swapfile`
Diffstat (limited to 'stage1')
-rwxr-xr-xstage1/01-sys-tweaks/00-run.sh8
-rw-r--r--stage1/01-sys-tweaks/files/fstab3
2 files changed, 11 insertions, 0 deletions
diff --git a/stage1/01-sys-tweaks/00-run.sh b/stage1/01-sys-tweaks/00-run.sh
index 41985f4..174b98f 100755
--- a/stage1/01-sys-tweaks/00-run.sh
+++ b/stage1/01-sys-tweaks/00-run.sh
@@ -15,6 +15,14 @@ mkdir -p /data/tmp/upper
mkdir -p /data/tmp/work
mkdir -p /data/var/upper
mkdir -p /data/var/work
+
+# Memory ~1G -> Swap 2G; BUT slow and small sd-card
+# Use 200MB (Raspberry comes with 100MB default)
+rm -f /data/swapfile
+dd if=/dev/zero of=/data/swapfile bs=1M count=200
+mkswap /data/swapfile
+chmod 600 /data/swapfile
+
if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then
adduser --disabled-password --gecos "" ${FIRST_USER_NAME}
fi
diff --git a/stage1/01-sys-tweaks/files/fstab b/stage1/01-sys-tweaks/files/fstab
index bea1fe3..fdb97f1 100644
--- a/stage1/01-sys-tweaks/files/fstab
+++ b/stage1/01-sys-tweaks/files/fstab
@@ -1,8 +1,11 @@
proc /proc proc defaults 0 0
+
BOOTDEV /boot vfat defaults 0 2
DATADEV /data ext4 defaults,noatime,noauto 0 1
ROOTDEV / ext4 defaults,noatime,ro,errors=remount-ro 0 0
+/data/swapfile none swap defaults 0 0
+
# defaults = rw, suid, dev, exec, auto, nouser, and async
# we replace auto -> noauto,x-systemd.automount
#overlay /etc overlay noauto,x-systemd.automount,rw,suid,dev,exec,nouser,async,noatime,lowerdir=/etc,upperdir=/data/etc/upper,workdir=/data/etc/work 0 0