Browse Source

Don't use --apparent-size to calculate rootfs total size.

Not using this option produces a more realistic result, because block
padding has to be taken into account when calculating the totals. It
is not a perfect method however, since the calculation becomes
dependent on the block size of the filesystem on the build machine.
4096 is a *very* common size though, and almost certainly will be the
size used both on the build host and in the resulting filesystem.

Changelog: Changed the calculation of occupied space on the rootfs
partition to a more accurate formula.

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
2.0.x
Kristian Amlie 5 years ago
parent
commit
3812d85dbe
No known key found for this signature in database GPG Key ID: F464407C996AF03F
  1. 2
      mender-convert-package

2
mender-convert-package

@ -140,7 +140,7 @@ artifact_name=$(cat work/rootfs/etc/mender/artifact_info | sed 's/[^=]*=//')
image_name="${device_type}-${artifact_name}"
actual_rootfs_size=$(sudo du --apparent-size -s --block-size=512 work/rootfs | cut -f 1)
actual_rootfs_size=$(sudo du -s --block-size=512 work/rootfs | cut -f 1)
# 50 % free space, not to be confused with rootfs_part_sectors
rootfs_image_sectors=$(awk -v r1="$actual_rootfs_size" 'BEGIN{printf "%.0f", r1 * 1.50}')

Loading…
Cancel
Save