From 7e6b1521a827f82ff2d2db1274d227c1c3b48374 Mon Sep 17 00:00:00 2001 From: Dolorosus Date: Sun, 16 Apr 2023 11:59:01 +0200 Subject: [PATCH] Calculating add. free space Calculating freespace instead of adding a fixed amount. --- pishrink.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pishrink.sh b/pishrink.sh index ba291f0..4eadbd5 100755 --- a/pishrink.sh +++ b/pishrink.sh @@ -330,15 +330,8 @@ if [[ $currentsize -eq $minsize ]]; then exit 11 fi -#Add some free space to the end of the filesystem -extra_space=$(($currentsize - $minsize)) -logVariables $LINENO extra_space -for space in 5000 1000 100; do - if [[ $extra_space -gt $space ]]; then - minsize=$(($minsize + $space)) - break - fi -done +#Add 5% free space to the end of the filesystem +minsize=$(($minsize + ($minsize/20))) logVariables $LINENO minsize #Shrink filesystem