Switch to mkfs.ext4 56/323256/3
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 24 Apr 2025 20:34:11 +0000 (22:34 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 7 May 2025 19:20:52 +0000 (21:20 +0200)
It looks like mkfs.ext2 is no longer universally available.

While mkfs.ext4 can still create ext2 filesystems,
mount won't necessarily still support mounting those.

Change-Id: I7a404b9a8feca5a281543f6fad1b50c0566cf574

src/service/src/dir_backend_fixed_size.cpp

index c79c7b70c89ef21f43d0e59c7e10a290e69eb135..7b13edb9b3d3ee27d30c7bf8f421696626e514b2 100644 (file)
@@ -47,7 +47,7 @@ static void do_mkfs(const fs::path& image_path, int uid, int gid, uint64_t size_
 {
        const auto child_pid = OS::throwing_fork();
        if (child_pid == 0) {
-               const auto mkfs = "/usr/sbin/mkfs.ext2"sv;
+               const auto mkfs = "/usr/sbin/mkfs.ext4"sv;
 
                /* Would ideally be std::format instead of this ugly stack,
                 * but some important downstream forks use obsolete gcc. */
@@ -60,6 +60,7 @@ static void do_mkfs(const fs::path& image_path, int uid, int gid, uint64_t size_
 
                execl
                        ( mkfs.data(), mkfs.data() /* argv[0] convention */
+                       , "-t", "ext4"
                        , "-E", owner_arg.c_str()
                        , "-m", "0"
                        , image_path.c_str()
@@ -69,7 +70,7 @@ static void do_mkfs(const fs::path& image_path, int uid, int gid, uint64_t size_
 
                _exit(1);
        } else {
-               OS::throw_if_child_failed(child_pid, "mkfs.ext2 failed!");
+               OS::throw_if_child_failed(child_pid, "mkfs.ext4 failed!");
        }
 }