← 返回命令列表

Linux command

mkfs.fat 命令

安全

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

常用示例

Example

sudo mkfs.fat [/dev/sdXY]

Example

sudo mkfs.fat -n [volume_name] [/dev/sdXY]

Example

sudo mkfs.fat -i [volume_id] [/dev/sdXY]

Example

sudo mkfs.fat -F [12|16|32] [/dev/sdXY]

Example

sudo mkfs.fat -f 4 [/dev/sdXY]

Check device

sudo mkfs.fat -c [/dev/sdXY]

说明

mkfs.fat creates MS-DOS FAT filesystems on devices or image files. It supports FAT12, FAT16, and FAT32 variants used by DOS, Windows, and most consumer electronics. The block-count parameter specifies filesystem size in 1024-byte blocks. When omitted, the tool fills available device space. FAT type is automatically selected based on filesystem size unless explicitly specified with -F. FAT filesystems use a file allocation table to track cluster allocation. Multiple copies of this table (default 2) provide redundancy. The filesystem remains widely used for USB drives, SD cards, and EFI system partitions due to its universal compatibility.

参数

-F _fat-size_
Specify FAT type: 12, 16, or 32 bit; auto-selected based on size if omitted
-n _volume-name_
Set volume label; maximum 11 characters
-i _volume-id_
Set 32-bit hexadecimal volume ID
-f _number_
Number of file allocation tables; default is 2
-s _sectors_
Sectors per cluster; must be a power of 2
-S _size_
Logical sector size in bytes (512, 1024, 2048, 4096, 8192, 16384, or 32768)
-c
Check device for bad blocks before creating filesystem
-l _filename_
Read bad blocks list from file
-r _entries_
Number of root directory entries; default 112-512 depending on FAT type
-R _sectors_
Number of reserved sectors; default 1 for FAT12/16, 32 for FAT32
-a
Disable alignment of data structures
-A
Toggle Atari filesystem variant
-C
Create image file instead of using device; requires block-count
-v
Verbose output mode
-b _sector_
Location of backup boot sector for FAT32
-D _number_
BIOS drive number; 0x80+ for hard disks, 0x00-0x7F for floppies
-I
Ignore safety checks; required for superfloppy format disks

FAQ

What is the mkfs.fat command used for?

mkfs.fat creates MS-DOS FAT filesystems on devices or image files. It supports FAT12, FAT16, and FAT32 variants used by DOS, Windows, and most consumer electronics. The block-count parameter specifies filesystem size in 1024-byte blocks. When omitted, the tool fills available device space. FAT type is automatically selected based on filesystem size unless explicitly specified with -F. FAT filesystems use a file allocation table to track cluster allocation. Multiple copies of this table (default 2) provide redundancy. The filesystem remains widely used for USB drives, SD cards, and EFI system partitions due to its universal compatibility.

How do I run a basic mkfs.fat example?

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

What does -F _fat-size_ do in mkfs.fat?

Specify FAT type: 12, 16, or 32 bit; auto-selected based on size if omitted