From a443290ad031dc3522f78153a41b3e7a12dc217a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 27 Jun 2021 01:49:16 +0200 Subject: Replace `dphys-swapfile` with static 200MB `/data/swapfile` --- stage1/01-sys-tweaks/00-run.sh | 8 ++++++++ stage1/01-sys-tweaks/files/fstab | 3 +++ 2 files changed, 11 insertions(+) (limited to 'stage1') 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 -- cgit v1.2.3