From b9f1c44dbb87bf47b6b7b0031d349eccc9f355d5 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 7 May 2022 18:03:00 +0200 Subject: [PATCH] Meta: Tweak default disk size calculation to not be as gratuitous Instead of first doubling the required size for the determined inode count and then _also_ tripling the sum of that and the determined disk size, let's be a bit more reasonable and just double the sum of inode count * size and disk size. This results in a 1.4GB _disk_image, instead of the 2GB from before (for < 800MB worth of files). --- Meta/build-image-qemu.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Meta/build-image-qemu.sh b/Meta/build-image-qemu.sh index 6b58ac900a..ecc06eb4e7 100755 --- a/Meta/build-image-qemu.sh +++ b/Meta/build-image-qemu.sh @@ -71,7 +71,9 @@ inode_usage() { INODE_SIZE=128 INODE_COUNT=$(($(inode_usage "$SERENITY_SOURCE_DIR/Base") + $(inode_usage Root))) -DISK_SIZE_BYTES=$((($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root) + INODE_COUNT) * 1024)) +INODE_COUNT=$((INODE_COUNT + 2000)) # Some additional inodes for toolchain files, could probably also be calculated +DISK_SIZE_BYTES=$((($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root)) * 1024)) +DISK_SIZE_BYTES=$((DISK_SIZE_BYTES + (INODE_COUNT * INODE_SIZE))) if [ -z "$SERENITY_DISK_SIZE_BYTES" ]; then # Try to use heuristics to guess a good disk size and inode count. @@ -80,7 +82,7 @@ if [ -z "$SERENITY_DISK_SIZE_BYTES" ]; then # * Indirect/doubly indirect/triply indirect blocks, # * Inodes and block bitmaps for each block group, # * Plenty of extra free space and free inodes. - DISK_SIZE_BYTES=$(((DISK_SIZE_BYTES + (INODE_COUNT * INODE_SIZE * 2)) * 3)) + DISK_SIZE_BYTES=$((DISK_SIZE_BYTES * 2)) INODE_COUNT=$((INODE_COUNT * 7)) else if [ "$DISK_SIZE_BYTES" -gt "$SERENITY_DISK_SIZE_BYTES" ]; then