mkfs

Used to create a Linux file system on the device

Supplementary instructions

mkfs command is used to create a Linux file system on a device (usually a hard drive). mkfs itself does not perform the work of establishing a file system, but calls related programs to perform it.

grammar

mkfs(options)(parameters)

Options

fs: Specify parameters when creating a file system;
-t<File system type>: Specify what kind of file system to create;
-v: Display version information and detailed usage;
-V: Display brief usage instructions;
-c: Before creating the file system, check whether the partition has bad sectors.

Parameters

Example

Create an msdos file system on /dev/hda5, check whether there are bad sectors, and list the process in detail:

mkfs -V -t msdos -c /dev/hda5

mkfs -t ext3 /dev/sda6 //Format the sda6 partition into ext3 format
mkfs -t ext2 /dev/sda7 //Format the sda7 partition into ext2 format