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 π
-aheap-based-allocation (deprecated) β set it to1or0to enable/disable heap based block allocation policy. If the value equals1, each of the active log areas are initially assigned separately according to the whole volume size. The default value is1. > heads up: this one is deprecated, so maybe don't get too attached π-bblock 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 is4096.-cdevice_name[@alias_filename] β build f2fs with these additional devices so the user can see all the devices as one big volume. Supports up to7devices except meta device. If@or@alias_filenameis given, the device is configured as a device alias. Note that alias_filename must match the device name π-ddebug-level β specify the level of debugging options. The default number is0, which shows basic debugging messages.-eextension-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 asjpg,gif,mpeg,mkv, and so on.-Eextension-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 asdb.-fβ force overwrite when an existing filesystem is detected on the device. By default,mkfs.f2fswill 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 π-gdefault-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.-lvolume-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.-ooverprovision-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 β¨-Ofeature-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.
-Cencoding: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, usenohashonlyflag. For android case, it will disable linear lookup by default.
- encoding:
-qβ quiet mode. With it,mkfs.f2fsdoes not show any messages, including the basic messages. π€«-rβ sets the checkpointing srand seed to0.-Rβ give root_owner option for initial uid/gid assignment. Default is set bygetuid()/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 is1, which means one segment is assigned to a section.-Sβ enable sparse mode.-t1/0 β specify1or0to enable or disable discard policy, respectively. The default value is1.-Ttimestamp β set inodes times to a given timestamp. By default, the current time will be used. This behaviour corresponds to the value-1.-wwanted-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 is1, 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 between8sections 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 default3.0%. Without-moption, 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)
- Copyright (c) 2012 Samsung Electronics Co., Ltd
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms