Replace dd with fallocate for faster file setup

This allows the use of sparse allocation on filesystems that support it,
allowing a fallback when the underlying filesystem doesn't.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
(cherry picked from commit 98c60e477d)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Ryan Lee 2024-12-03 13:08:24 -08:00 committed by John Johansen
parent a6bb35dbe7
commit 77962f6de3

View file

@ -64,7 +64,7 @@ mount_cleanup() {
}
do_onexit="mount_cleanup"
dd if=/dev/zero of=${mount_file} bs=1024 count=512 2> /dev/null
fallocate -l 512K ${mount_file}
/sbin/mkfs -t${fstype} -F ${mount_file} > /dev/null 2> /dev/null
/bin/mkdir ${mount_point}
/bin/mkdir ${mount_point2}