From 854834e1665dea4454c36468a8d25b02436eedec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Tue, 6 Dec 2022 09:47:30 +0100 Subject: [PATCH] armbian-install: limit automated swap creation to 16Gb (#4528) --- packages/bsp/common/usr/sbin/armbian-install | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/bsp/common/usr/sbin/armbian-install b/packages/bsp/common/usr/sbin/armbian-install index 648d0fb463..9138a4e68f 100755 --- a/packages/bsp/common/usr/sbin/armbian-install +++ b/packages/bsp/common/usr/sbin/armbian-install @@ -360,6 +360,13 @@ create_armbian() if [[ $2 == ${DISK_ROOT_PART} && -z $1 && $DEVICE_TYPE = uefi ]]; then + # create swap file size of your memory so we can use it for S4 + MEM_TOTAL=$(cat /proc/meminfo | awk '/MemTotal/ {print $2}') + + # but no more then 16Gb + [[ ${MEM_TOTAL} -gt 16107868 ]] && MEM_TOTAL=16107868 + dd if=/dev/zero of="${TempDir}"/rootfs/swapfile bs=${MEM_TOTAL} count=1024 conv=notrunc + # create swap file size of your memory so we can use it for S4 dd if=/dev/zero of="${TempDir}"/rootfs/swapfile bs=$(cat /proc/meminfo | awk '/MemTotal/ {print $2}') count=1024 conv=notrunc mkswap "${TempDir}"/rootfs/swapfile