The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

mkfs : Format the filesystem



The mkfs command is used to format a filesystem. It must be run as root.

The following are some common options for the mkfs command:

Supported filesystems include ext2, ext3, ext4, ms-dos, vfat, and ntfs.

Examples:
mkfs /dev/sdb1 ←Default filesystem format is ext2
mkfs -t ext3 /dev/sdb1 ←Format partition "/dev/sdb1" as ext3
# mkfs -t ext4 -L lib /dev/sdb2 ←Format as ext4, with label "lib"
# mkfs -t ext2 /dev/loop0p1 ←Format pseudo-device ("/dev/loop0" must be set up with losetup)

For more examples and options, please refer to the link.