From bc6c729a827e538c6f11d9400baf6c98e5e9782e Mon Sep 17 00:00:00 2001 From: AJ Jordan Date: Fri, 30 Nov 2018 23:46:09 -0500 Subject: [PATCH] Simplify block number calculation --- init/resize-rootfs-if-needed.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/init/resize-rootfs-if-needed.sh b/init/resize-rootfs-if-needed.sh index c3d21cb..2a93f1e 100755 --- a/init/resize-rootfs-if-needed.sh +++ b/init/resize-rootfs-if-needed.sh @@ -15,9 +15,7 @@ sysfs_xvda="/sys/class/block/xvda" # if root filesystem use already (almost) the whole dis non_rootfs_data=$(( 250 * 1024 * 2 )) -rootfs_size=$(df --output=size / | tail -n 1) -# convert to 512-byte blocks -rootfs_size=$(( rootfs_size * 2 )) +rootfs_size=$(df --block-size=512 --output=size / | tail -n 1) if [ "$(cat "$sysfs_xvda/size")" -lt \ $(( non_rootfs_data + rootfs_size )) ]; then echo "root filesystem already at $rootfs_size blocks" >&2