← 返回命令列表

Linux command

mkfs.f2fs 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Example

sudo mkfs.f2fs [/dev/sdXY]

Example

sudo mkfs.f2fs -l [volume_label] [/dev/sdXY]

Example

sudo mkfs.f2fs -O encrypt [/dev/sdXY]

Example

sudo mkfs.f2fs -O compress [/dev/sdXY]

Force

sudo mkfs.f2fs -f [/dev/sdXY]

说明

mkfs.f2fs creates a Flash-Friendly File System (F2FS) on block devices. F2FS is a modern filesystem designed specifically for flash-based storage like SSDs, eMMC, and SD cards. The filesystem employs log-structured design principles optimized for NAND flash characteristics, providing better performance and extended device lifespan compared to traditional filesystems on flash media. It supports features like inline data, inline directories, extent-based mapping, and atomic writes. When creating a filesystem, the tool partitions the device into segments, sections, and zones for efficient garbage collection and wear leveling. The overprovision ratio reserves space for this purpose. Exit status is 0 on success, 1 on failure.

参数

-l _label_
Set the volume label for the filesystem
-a _0|1_
Use heap-based block allocation (1) or not (0); default is 1
-o _ratio_
Set overprovision ratio as a percentage; default is 5%
-s _segments_
Number of segments per section; default is 1
-z _sections_
Number of sections per zone; default is 1
-e _extensions_
Extensions for cold files (e.g., multimedia files)
-E _extensions_
Extensions for hot files (e.g., database files)
-w _size_
Sector size in bytes
-R _uid:gid_
Set root directory owner UID and GID
-f
Force overwrite if filesystem already exists on device
-q
Quiet mode; suppress output messages
-O _feature_
Enable filesystem features: encrypt, compress, quota, verity, casefold
-c _device_
Add additional device for multi-device volume (up to 7 devices)
-t _0|1_
Set discard policy; 1 enables discard support
-d _level_
Set debug level for verbose output
-T _timestamp_
Set inode timestamps to specified value
-S
Enable sparse mode for creating image files

FAQ

What is the mkfs.f2fs command used for?

mkfs.f2fs creates a Flash-Friendly File System (F2FS) on block devices. F2FS is a modern filesystem designed specifically for flash-based storage like SSDs, eMMC, and SD cards. The filesystem employs log-structured design principles optimized for NAND flash characteristics, providing better performance and extended device lifespan compared to traditional filesystems on flash media. It supports features like inline data, inline directories, extent-based mapping, and atomic writes. When creating a filesystem, the tool partitions the device into segments, sections, and zones for efficient garbage collection and wear leveling. The overprovision ratio reserves space for this purpose. Exit status is 0 on success, 1 on failure.

How do I run a basic mkfs.f2fs example?

Run `sudo mkfs.f2fs [/dev/sdXY]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -l _label_ do in mkfs.f2fs?

Set the volume label for the filesystem