Simplify block number calculation
This commit is contained in:
parent
4036e50604
commit
bc6c729a82
@ -15,9 +15,7 @@ sysfs_xvda="/sys/class/block/xvda"
|
|||||||
|
|
||||||
# if root filesystem use already (almost) the whole dis
|
# if root filesystem use already (almost) the whole dis
|
||||||
non_rootfs_data=$(( 250 * 1024 * 2 ))
|
non_rootfs_data=$(( 250 * 1024 * 2 ))
|
||||||
rootfs_size=$(df --output=size / | tail -n 1)
|
rootfs_size=$(df --block-size=512 --output=size / | tail -n 1)
|
||||||
# convert to 512-byte blocks
|
|
||||||
rootfs_size=$(( rootfs_size * 2 ))
|
|
||||||
if [ "$(cat "$sysfs_xvda/size")" -lt \
|
if [ "$(cat "$sysfs_xvda/size")" -lt \
|
||||||
$(( non_rootfs_data + rootfs_size )) ]; then
|
$(( non_rootfs_data + rootfs_size )) ]; then
|
||||||
echo "root filesystem already at $rootfs_size blocks" >&2
|
echo "root filesystem already at $rootfs_size blocks" >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user