Linux mkdosfs Command
The Linux mkdosfs command is used to create a DOS file system.
The device
refers to the device identifier where you want to create the DOS file system, such as /dev/hda1
, etc. block_count
is the number of blocks you wish to allocate. If block_count
is not specified, the system will automatically calculate the number of blocks suitable for the device size.
mkdosfs [ -c | -l filename ]
[ -f number_of_FATs ]
[ -F FAT_size ]
[ -i volume_id ]
[ -m message_file ]
[ -n volume_name ]
[ -r root_dir_entry ]
[ -s sector_per_cluster ]
[ -v ]
device
[ block_count ]
Parameters:
-c
Checks for bad blocks before creating the file system.-l
Reads bad block records from the specified file.-f
Specifies the number of File Allocation Tables (FATs). The default is 2. Currently, Linux FAT file systems do not support more than 2 FAT tables. Typically, this does not need to be changed.-F
Specifies the size of the FAT table, usually 12 or 16 bytes. 12 bytes are typically used for floppy disks, and 16 bytes for general hard disk partitions, known as FAT16 format. This value is usually selected appropriately by the system. Using FAT16 on floppy disks usually does not work, and vice versa for FAT12 on hard disks.-i
Specifies the Volume ID. It is typically a 4-byte number, like2e203a47
. If not provided, the system will generate one.-m
Changes the warning message displayed when a user tries to boot from this disk or partition that does not contain an operating system. You can edit the message in a file and specify it with this parameter, or use-m -
to input the message directly. Note that the string length in the file should not exceed 418 characters, including expanded tab symbols (TAB) and line breaks (line breaks count as two characters in DOS!).-n
Specifies the Volume Name, i.e., the disk label. As with the format command in DOS, it is optional. There is no default value.-r
Specifies the maximum number of files in the root directory. This number includes directories. The default value is 112 or 224 on floppy disks, and 512 on hard disks. Do not change this number unless necessary.-s
Number of sectors per cluster. It must be a power of 2. Do not change this value unless you know what you are doing.-v
Provides additional information.
Example
Format the disk in drive A to DOS format and set the label to "Tester":
mkdosfs -n Tester /dev/fd0