]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test: increase ext4 size in build_ext4_image
authorBenjamin Drung <benjamin.drung@canonical.com>
Tue, 27 Jan 2026 19:20:57 +0000 (20:20 +0100)
committerLaszlo <laszlo.gombos@gmail.com>
Tue, 27 Jan 2026 20:02:15 +0000 (15:02 -0500)
Adding a fixed amount of 10 MB to the ext4 image size might not be
enough (for example when using `build_ext4_image` in test 60).

So calculate the additional size by a percentaged and a fixed amount.

test/test-functions

index d6eeaf4dcca93ce0149cfb74aef11ad51f56f94f..bf2ecfa2c294bd0acfae3af37e807649b53f8911 100644 (file)
@@ -174,8 +174,8 @@ build_ext4_image() {
 
     local size
     size="$(du -s -b "${source_dir}" | cut -f 1)"
-    # Add 10 MB for ext4 journal
-    size="$((size + 10000000))"
+    # Add 5% extra + 5% for reserved blocks + 10% for metadata + 8 MB for ext4 journal
+    size="$((size * 120 / 100 + 8000000))"
 
     rm -f "$image"
     truncate -s "$size" "$image"