[LTP] [PATCH] mkfs: force block size to 1024 for ext3 and ext4

Thadeu Lima de Souza Cascardo cascardo@canonical.com
Mon May 10 15:47:39 CEST 2021


ext3 and ext4 filesystems will reserve at least 1024 blocks for the
journal.  With a blocksize of 4096, this will be 25% of the filesystem size
without accounting for any other overhead.

/etc/mke2fs.conf will use 1024 block size for small filesystems, which are
between 3M and 512M. However, on recent versions of Ubuntu, this
configuration has changed and thet default blocksize is 4096 even for small
filesystems.

Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
to the expected results, as journals will take only 1M.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 testcases/commands/mkfs/mkfs01.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/commands/mkfs/mkfs01.sh b/testcases/commands/mkfs/mkfs01.sh
index 3e3e56719cf3..17c7fb9e4a1a 100755
--- a/testcases/commands/mkfs/mkfs01.sh
+++ b/testcases/commands/mkfs/mkfs01.sh
@@ -96,6 +96,9 @@ mkfs_test()
 	if [ "$fs_type" = "xfs" ] || [ "$fs_type" = "btrfs" ]; then
 		fs_op="$fs_op -f"
 	fi
+	if [ "$fs_type" = "ext3" ] || [ "$fs_type" = "ext4" ]; then
+		fs_op="$fs_op -b 1024"
+	fi
 
 	local mkfs_cmd="mkfs $mkfs_op $fs_op $device $size"
 
-- 
2.27.0



More information about the ltp mailing list