feat(perf): swap 4G->8G via second swapfile, applied live [#755]

Applied on my.knownelement.com 2026-09-03 (founder-approved):
/apps.swap2 4G, fstab-persisted, no restarts. Verification + closure
note: https://projects.knownelement.com/issues/755#note-13
This commit is contained in:
2026-09-03 11:02:06 -05:00
parent 87606da528
commit 482d0614f7
2 changed files with 40 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# grow-swap2.sh — add a second 4G swapfile on the Cloudron host [#755]
# Founder-approved 2026-09-03. Second-file approach: no swapoff, no restart,
# zero risk to the running fleet. Idempotent — safe to re-run.
#
# Applied live on my.knownelement.com 2026-09-03 (result: /apps.swap +
# /apps.swap2 = 8G total, fstab persisted). Re-runnable on any host that
# needs the same headroom; set NEW/SIZE_MB to taste.
set -euo pipefail
NEW=/apps.swap2
SIZE_MB=4096
if swapon --show=NAME --noheadings | grep -qx "$NEW"; then
echo "$NEW already active"
else
if [ -e "$NEW" ]; then
echo "ERROR: $NEW exists but is not active — inspect manually" >&2
exit 1
fi
fallocate -l "${SIZE_MB}M" "$NEW" 2>/dev/null \
|| dd if=/dev/zero of="$NEW" bs=1M count="$SIZE_MB" status=none
chmod 600 "$NEW"
mkswap "$NEW"
swapon "$NEW"
echo "activated $NEW"
fi
if grep -q "^$NEW " /etc/fstab; then
echo "fstab entry already present"
else
printf '%s none swap sw 0 0\n' "$NEW" >> /etc/fstab
echo "fstab entry added"
fi
echo "--- swapon ---"
swapon --show
echo "--- free ---"
free -h