Skip to content

Commit 7ed6f00

Browse files
committed
fix: rounding problems lead to swap recreate
1 parent d0c0669 commit 7ed6f00

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎system/cuos/functions.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ create_swap_and_resize_fs() {
286286
SWAP_SIZE_GB=8
287287
TARGET_SIZE="$((SWAP_SIZE_GB*1024*1024*1024))"
288288
FS_SIZE="$(df --output=size -B1 "$(dirname "$SWAPFILE")" | tail -n1)"
289-
MAX_SIZE="$((FS_SIZE / 4))"
289+
MAX_SIZE="$((FS_SIZE / 4 / 1024 / 1024 * 1024 * 1024))"
290290
if [ "${TARGET_SIZE}" -gt "${MAX_SIZE}" ]; then
291291
TARGET_SIZE="${MAX_SIZE}"
292292
fi

0 commit comments

Comments
 (0)