summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-13 16:40:46 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-16 13:55:49 +0100
commit2d96440fd551b3c037369857b6c0a26e931144d7 (patch)
tree04bd4484d69d488c17b5c41a7e2aee52b4d28ee2
parent8d433a99a414adfc6785fd892b0349847f9488b4 (diff)
downloadsystemd-2d96440fd551b3c037369857b6c0a26e931144d7.tar.gz
makefs: add "support" for f2fs
The man page doesn't quite match what --help says, and I needed to use "-f" to write a wiped partition. This all feels a bit experimental, but the fs has some adherents, and we should make it easy to use. (Also, an empty 256MB device formatted and mounted shows up as Filesystem Size Used Avail Use% Mounted on /dev/loop0 254M 85M 170M 34% /var/tmp/mount which also seems a bit over the top…) Requested in https://github.com/systemd/systemd/pull/21275#issuecomment-967928690.
-rw-r--r--src/shared/mkfs-util.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/shared/mkfs-util.c b/src/shared/mkfs-util.c
index de03cd3c7d..061a2c2ef7 100644
--- a/src/shared/mkfs-util.c
+++ b/src/shared/mkfs-util.c
@@ -183,6 +183,17 @@ int make_filesystem(
discard ? NULL : "--nodiscard",
NULL);
+ } else if (streq(fstype, "f2fs")) {
+ (void) execlp(mkfs, mkfs,
+ "-q",
+ "-g", /* "default options" */
+ "-f", /* force override, without this it doesn't seem to want to write to an empty partition */
+ "-l", label,
+ "-U", vol_id,
+ "-t", one_zero(discard),
+ node,
+ NULL);
+
} else if (streq(fstype, "xfs")) {
const char *j;
@@ -223,7 +234,7 @@ int make_filesystem(
_exit(EXIT_FAILURE);
}
- if (STR_IN_SET(fstype, "ext2", "ext3", "ext4", "btrfs", "xfs", "vfat", "swap"))
+ if (STR_IN_SET(fstype, "ext2", "ext3", "ext4", "btrfs", "f2fs", "xfs", "vfat", "swap"))
log_info("%s successfully formatted as %s (label \"%s\", uuid %s)",
node, fstype, label, vol_id);
else