Linux command
mkfs.ext4 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Example
sudo mkfs.ext4 /dev/sdXY
Example
sudo mkfs.ext4 -L [label] /dev/sdXY
Example
sudo mkfs.ext4 -m [1] /dev/sdXY
Example
sudo mkfs.ext4 -b [4096] /dev/sdXY
Example
sudo mkfs.ext4 -E root_owner=[uid]:[gid] -U [uuid] /dev/sdXY
Quiet
sudo mkfs.ext4 -q /dev/sdXY
说明
mkfs.ext4 creates an ext4 filesystem on a device. ext4 is the default Linux filesystem, offering journaling, large file support, and excellent performance. It is equivalent to mke2fs -t ext4.
参数
- -L _LABEL_
- Set volume label (max 16 characters).
- -b _BLOCKSIZE_
- Set block size in bytes (1024, 2048, or 4096).
- -m _PERCENT_
- Reserved blocks percentage for super-user (default: 5%).
- -i _BYTES_PER_INODE_
- Set bytes per inode ratio.
- -N _INODES_
- Set number of inodes.
- -U _UUID_
- Set filesystem UUID.
- -E _OPTIONS_
- Extended options (comma-separated), e.g. root_owner=uid:gid, discard, stride=N, stripe-width=N.
- -O _FEATURES_
- Set filesystem features (comma-separated), e.g. ^has_journal, extent, dir_index.
- -T _USAGE_TYPE_
- Specify usage type (e.g. largefile, largefile4, news, small) to set default parameters.
- -c
- Check the device for bad blocks before creating the filesystem.
- -cc
- Perform a slower, destructive read-write bad blocks test.
- -n
- Dry run; show what would be done without creating the filesystem.
- -F
- Force creation even if the device is not a block special device or appears in use.
- -q
- Quiet execution.
FAQ
What is the mkfs.ext4 command used for?
mkfs.ext4 creates an ext4 filesystem on a device. ext4 is the default Linux filesystem, offering journaling, large file support, and excellent performance. It is equivalent to mke2fs -t ext4.
How do I run a basic mkfs.ext4 example?
Run `sudo mkfs.ext4 /dev/sdXY` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -L _LABEL_ do in mkfs.ext4?
Set volume label (max 16 characters).