MKFS.F2FS(8)

πŸ’… MKFS.F2FS β€” create an F2FS file system

okay so real talk: you're about to make a whole f2fs filesystem from scratch, bestie. This is the mkfs.f2fs page, section 8 of the System Manager's Manual, and I'm gonna walk you through it like we're texting 🫢


✨ NAME ✨

mkfs.f2fs β€” create an F2FS file system πŸ’–


🌸 SYNOPSIS 🌸

mkfs.f2fs [ -c device-list ] [ -d debug-level ] [ -e extension-list ]
          [ -E extension-list ] [ -f ] [ -g default-options ] [ -H ] [ -i ]
          [ -l volume-label ] [ -m ] [ -o overprovision-ratio-percentage ]
          [ -O feature-list ] [ -C encoding:flags ] [ -q ] [ -r ]
          [ -R root_owner ] [ -s #-of-segments-per-section ] [ -S ]
          [ -t nodiscard/discard ] [ -T timestamp ] [ -w wanted-sector-size ]
          [ -z #-of-sections-per-zone ] [ -V ] [ -Z #-of-reserved-sections ]
          device [sectors]

πŸ¦‹ DESCRIPTION πŸ¦‹

So mkfs.f2fs makes an f2fs filesystem, and yeah it's usually going on a disk partition. device is the special file that corresponds to your device (think like /dev/sdXX). sectors is optional and it's there so you can say exactly how big the filesystem should be πŸ“

The exit code is literally the vibe check of whether it worked: 0 on success and 1 on failure. No in-between, no drama πŸ’€


πŸŽ€ OPTIONS πŸŽ€

  • -a heap-based-allocation (deprecated) β€” set it to 1 or 0 to enable/disable heap based block allocation policy. If the value equals 1, each of the active log areas are initially assigned separately according to the whole volume size. The default value is 1. > heads up: this one is deprecated, so maybe don't get too attached πŸ™ˆ
  • -b block size β€” specify the block size in bytes. Valid blocksizes are powers of 2. RN the kernel is only able to mount f2fs filesystems where the block size matches the page size. The default value is 4096.
  • -c device_name[@alias_filename] β€” build f2fs with these additional devices so the user can see all the devices as one big volume. Supports up to 7 devices except meta device. If @ or @alias_filename is given, the device is configured as a device alias. Note that alias_filename must match the device name πŸ‘€
  • -d debug-level β€” specify the level of debugging options. The default number is 0, which shows basic debugging messages.
  • -e extension-list β€” specify a list of file extensions that f2fs will treat as cold files. The data of files with those extensions will be stored in the cold log. The default list includes most of the multimedia file extensions such as jpg, gif, mpeg, mkv, and so on.
  • -E extension-list β€” specify a list of file extensions that f2fs will treat as hot files. The data of files with those extensions will be stored in the hot log. The default list includes database file extensions, such as db.
  • -f β€” force overwrite when an existing filesystem is detected on the device. By default, mkfs.f2fs will not write to the device if it suspects that there is a filesystem or partition table on the device already. so it's the "yes I'm sure, do it anyway" flag πŸ’…
  • -g default-options β€” use a default set of options. The following values are supported:
    • android β€” use default options for Android having "-d1 -f -w 4096 -R 0:0 -O encrypt -O project_quota,extra_attr,{quota} -O verity".
  • -H β€” specify support write hint.
  • -i β€” enable extended node bitmap.
  • -l volume-label β€” specify the volume label to the partition mounted as F2FS 🏷️
  • -m β€” specify f2fs filesystem to supports the block zoned feature. Without it, the filesystem doesn't support the feature.
  • -o overprovision-ratio-percentage β€” specify the percentage of the volume that will be used as overprovision area. This area is hidden to users, and utilized by F2FS cleaner. If not specified, the best number will be assigned automatically according to the partition size ✨
  • -O feature-list β€” set additional features for the filesystem. Features are comma separated, and the flag can be repeated. The following features are supported:
    • encrypt β€” enable support for filesystem level encryption.
    • extra_attr β€” enable extra attr feature, required for some of the other features.
    • project_quota β€” enable project ID tracking. This is used for projet quota accounting. Requires extra attr. (yes "projet", that's how the page spells it, I don't make the rules 😭)
    • inode_checksum β€” enable inode checksum. Requires extra attr.
    • flexible_inline_xattr β€” enable flexible inline xattr. Requires extra attr.
    • quota β€” enable quotas.
    • inode_crtime β€” enable inode creation time feature. Requires extra attr.
    • lost_found β€” enable lost+found feature.
    • verity β€” enable support for verity protected files (a.k.a. fs-verity).
    • sb_checksum β€” enable superblock checksum.
    • casefold β€” enable casefolding support in the filesystem. Optional flags can be passed with -C.
    • compression β€” enable support for filesystem level compression. Requires extra attr.
    • ro β€” enable readonly feature to eliminate OVP/SSA on-disk layout for small readonly partition.
  • -C encoding:flags β€” support casefolding with a specific encoding, with optional comma separated flags.
    • encoding:
      • utf8 β€” use UTF-8 for casefolding.
    • flags:
      • [no]strict β€” this flag specifies that invalid strings should be rejected by the filesystem. Default is disabled.
      • [no]hashonly β€” this flag specifies that linear lookup fallback is off during lookup, to turn on linear lookup fallback, use nohashonly flag. For android case, it will disable linear lookup by default.
  • -q β€” quiet mode. With it, mkfs.f2fs does not show any messages, including the basic messages. 🀫
  • -r β€” sets the checkpointing srand seed to 0.
  • -R β€” give root_owner option for initial uid/gid assignment. Default is set by getuid()/getgid(), and assigned by "-R $uid:$gid".
  • -s #-of-segments-per-section β€” specify the number of segments per section. A section consists of multiple consecutive segments, and is the unit of garbage collection. The default number is 1, which means one segment is assigned to a section.
  • -S β€” enable sparse mode.
  • -t 1/0 β€” specify 1 or 0 to enable or disable discard policy, respectively. The default value is 1.
  • -T timestamp β€” set inodes times to a given timestamp. By default, the current time will be used. This behaviour corresponds to the value -1.
  • -w wanted-sector-size β€” specify the sector size in bytes. Without it, the sectors will be calculated by device sector size.
  • -z #-of-sections-per-zone β€” specify the number of sections per zone. A zone consists of multiple sections. F2FS allocates segments for active logs with separated zones as much as possible. The default number is 1, which means a zone consists of one section.
  • sectors β€” number of sectors. Default is determined by device size.
  • -V β€” print the version number and exit.
  • -Z #-of-reserved-sections β€” specify the number of GC reserved sections for zoned device. If specified to non-zero, reserved segments count is set to the larger size between 8 sections and the input value. If specified to zero, the best number will be assigned automatically according to the partition size. If overprovision-ratio-percentage is not specified, it will set to default 3.0%. Without -m option, the filesystem doesn't support the feature.
  • -h, --help β€” print usage and exit. 🫢

πŸ‘‘ AUTHOR πŸ‘‘

This version of mkfs.f2fs has been written by Jaegeuk Kim <jaegeuk.kim@samsung.com>. iconic behavior honestly πŸ’œ


🌈 AVAILABILITY 🌈

mkfs.f2fs is available from git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git β€” go clone it bestie ⭐


🌸 SEE ALSO 🌸

mkfs(8), fsck.f2fs(8), dump.f2fs(8), defrag.f2fs(8), resize.f2fs(8), sload.f2fs(8) πŸ¦‹


okay that's the whole page!! this one comes from the f2fs-tools source, dated and shelved under MKFS.F2FS(8) in the System Manager's Manual β€” so like, section 8, filesystem-creation territory, and now you know it by heart. slay πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: f2fs-tools 1.17.0-1 Β· GPL-2.0-only AND (GPL-2.0-only OR LGPL-2.1-only)
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms