Linux Command: mkfs

Published on March 30, 2022 at 5:54 pm by LEW


In this post I am presenting the mkfs command. It is an acronym for MaKe File System. Assuming you have partitioned a drive with fdisk (see this post), you are going to want to format the drive partitions by installing a file system on them.

The mkfs command has several variations that can confuse new users, and can seem a bit confusing at first. In this post we will attempt to simplify and codify them.

Syntax and Function

The basic syntax for mkfs is as follows.

mkfs [options] [fs-options] device

Where some experience confusion is with the -t option. This stands for type, and represents the type of file system to format a partition with. There are a variety of file systems; fat, ext4, bfs, ntfs, ect. If you where to create a FAT file system, there are two forms of the command you might use or run into. The first as per the above syntax would be mkfs -t fat. The second alternative you might would be mksf.fat. They both do the same thing, one just appends the type to the command name.


To create a basic EXT4 file system on drive partition sdb3, you can use either of the following command.

mkfs -t ext4 /dev/sdb3

mkfs.ext4 /dev/sdb3

This creates a standard EXT4 file system. It is good for most cases. However, sometimes more advanced users may want to make specific adjustments. This is where the fs-options comes in. Using this, you can change things like blocks, inodes, and journaling options.

If you need a a partition to be usable by Windows (for example), you would need to create a file system type of; FAT or NTFS.

mkfs -t fat dev/sdb3

mkfs -t fat -F 32 dev/sdb3

mkfs -t ntfs dev/sdb3

Note that mkfs.fat creates a FAT16 file system by default. For the 32 bit version used today you would need to add the file system option, -F 32.


Some of the more common command line op0tions for mkfs are as follows.

Refer to the man page for a complete list of options. Also refer to man page for specific file system type to see file system options


This has been a quick overview of the mkfs command and some of the more common options/usage. It should cover most things an average user would need to do. Please refer to the man page for your distribution for a complete list of all options and features.

Add New Comment

Your email address will not be published. Required fields are marked *