improve reserved blocks math
bc(1) round to the lower integer, so we add 1 to always be around the ceiling.
This commit is contained in:
parent
df9af8061d
commit
48cbf6385f
|
@ -888,9 +888,9 @@ if is_debian; then
|
||||||
fi
|
fi
|
||||||
reservedBlockCount=$(dumpe2fs -h "$part" 2>/dev/null | grep -e "Reserved block count:" | grep -Eo "[0-9]+")
|
reservedBlockCount=$(dumpe2fs -h "$part" 2>/dev/null | grep -e "Reserved block count:" | grep -Eo "[0-9]+")
|
||||||
# Use bc to have a rounded percentage
|
# 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
|
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
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue