From 48cbf6385fd703d44aee6cbc7c91d676b2b381f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Sat, 23 Mar 2019 01:01:38 +0100 Subject: [PATCH] improve reserved blocks math bc(1) round to the lower integer, so we add 1 to always be around the ceiling. --- evocheck.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index be3975e..01fb3f3 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -888,9 +888,9 @@ if is_debian; then fi reservedBlockCount=$(dumpe2fs -h "$part" 2>/dev/null | grep -e "Reserved block count:" | grep -Eo "[0-9]+") # Use bc to have a rounded percentage - percentage=$(echo "scale=0; ${reservedBlockCount} * 100 / ${blockCount}" | bc) + percentage=$(echo "(${reservedBlockCount} * 100 / ${blockCount}) + 1" | bc) if [ "$percentage" -lt 5 ]; then - failed "IS_TUNE2FS_M5" "Partition ${part} has less than 5% reserved blocks!" + failed "IS_TUNE2FS_M5" "Partition ${part} has less than 5% reserved blocks (${percentage}%)" fi done fi