Linux command
mkfs 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Example
sudo mkfs /dev/sdXY
Example
sudo mkfs -t ext4 /dev/sdXY
Example
sudo mkfs -c -t ext4 /dev/sdXY
Example
sudo mkfs -t xfs /dev/sdXY
Example
sudo mkfs -V -t ext4 /dev/sdXY
说明
mkfs builds a Linux filesystem on a device, usually a hard disk partition. It is a front-end wrapper that calls filesystem-specific utilities like mkfs.ext4 or mkfs.xfs. The device can be a block device or a regular file.
参数
- -t, --type TYPE
- Specify filesystem type (ext2, ext3, ext4, xfs, btrfs, etc.); defaults to ext2
- -c
- Check the device for bad blocks before building
- -V, --verbose
- Produce verbose output including executed commands
- -h, --help
- Display help text
- -V, --version
- Display version information
FAQ
What is the mkfs command used for?
mkfs builds a Linux filesystem on a device, usually a hard disk partition. It is a front-end wrapper that calls filesystem-specific utilities like mkfs.ext4 or mkfs.xfs. The device can be a block device or a regular file.
How do I run a basic mkfs example?
Run `sudo mkfs /dev/sdXY` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -t, --type TYPE do in mkfs?
Specify filesystem type (ext2, ext3, ext4, xfs, btrfs, etc.); defaults to ext2