Correct size_margin for rootfs resizes

See
https://github.com/QubesOS/qubes-core-agent-linux/pull/146#discussion_r238080117
for details; but tl;dr:

* Journal size is 64M
* Inode table is 256 bytes * 643376 inodes allocated = ~157M
* Reserved GDT blocks take up 1024 blocks * 4096 byte block size = 4M
* Fixed-size parts of the filesystem probably take up another MB or
  two

These actually adds up to more than the 222M number used in this
commit. But it seems _about_ right, so just Ship It(tm).
This commit is contained in:
AJ Jordan 2018-12-01 18:46:46 -05:00
parent c05310f61c
commit 0f3b4985c3
No known key found for this signature in database
GPG Key ID: A4FDB7BE12F63EC3

View File

@ -14,7 +14,9 @@ fi
sysfs_xvda="/sys/class/block/xvda"
# if root filesystem use already (almost) the whole dis
size_margin=$(( 250 * 1024 * 2 ))
# 203M for BIOS and /boot data, 222 for ext4 filesystem overhead
# See QubesOS/qubes-core-agent-linux#146 for more details
size_margin=$(((222 + 203) * 2 * 1024))
rootfs_size=$(df --block-size=512 --output=size / | tail -n 1 | tr -d ' ')
if [ $(cat $sysfs_xvda/size) -lt \
$(( size_margin + rootfs_size )) ]; then