The mkfs command build a file system on a block device:
#mkfs
[options
]device
mkfs is a front end for builder utilities in /sbin
such as mkfs.ext4. You can use either the mkfs command
with the -t fstype
option or the builder utility
to specify the type of file system to build. For example, the following commands are
equivalent ways of creating an ext4
file system with the label
Projects
on the device /dev/sdb1
:
#mkfs -t ext4 -L Projects /dev/sdb1
#mkfs.ext4 -L Projects /dev/sdb1
If you do not specify the file system type to makefs , it creates an
ext2
file system.
To display the type of a file system, use the blkid command:
# blkid /dev/sdb1
/dev/sdb1: UUID="ad8113d7-b279-4da8-b6e4-cfba045f66ff" TYPE="ext4" LABEL="Projects"
The blkid command also display information about the device such as its UUID and label.
Each file system type supports a number of features that you can enable or disable by
specifying additional options to mkfs or the build utility. For example,
you can use the -J option to specify the size and location of the journal
used by the ext3
and ext4
file system types.
For more information, see the blkid(8)
, mkfs(8)
, and
mkfs.
manual pages.fstype
(8)