{
    "mode": "man",
    "parameter": "mkfs",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/mkfs/8/json",
    "generated": "2026-06-02T19:34:42Z",
    "synopsis": "mkfs [options] [-t type] [fs-options] device [size]",
    "sections": {
        "NAME": {
            "content": "mkfs - build a Linux filesystem\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "mkfs [options] [-t type] [fs-options] device [size]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "",
            "subsections": [
                {
                    "name": "This mkfs frontend is deprecated in favour of filesystem specific mkfs.<type> utils.",
                    "content": "mkfs is used to build a Linux filesystem on a device, usually a hard disk partition. The\ndevice argument is either the device name (e.g., /dev/hda1, /dev/sdb2), or a regular file\nthat shall contain the filesystem. The size argument is the number of blocks to be used for\nthe filesystem.\n\nThe exit status returned by mkfs is 0 on success and 1 on failure.\n\nIn actuality, mkfs is simply a front-end for the various filesystem builders (mkfs.fstype)\navailable under Linux. The filesystem-specific builder is searched for via your PATH\nenvironment setting only. Please see the filesystem-specific builder manual pages for further\ndetails.\n"
                }
            ]
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-t --type",
                    "content": "Specify the type of filesystem to be built. If not specified, the default filesystem type\n(currently ext2) is used.\n\nfs-options\nFilesystem-specific options to be passed to the real filesystem builder.\n",
                    "flag": "-t",
                    "long": "--type"
                },
                {
                    "name": "-V --verbose",
                    "content": "Produce verbose output, including all filesystem-specific commands that are executed.\nSpecifying this option more than once inhibits execution of any filesystem-specific\ncommands. This is really only useful for testing.\n",
                    "flag": "-V",
                    "long": "--verbose"
                },
                {
                    "name": "-V --version",
                    "content": "Display version information and exit. (Option -V will display version information only\nwhen it is the only parameter, otherwise it will work as --verbose.)\n",
                    "flag": "-V",
                    "long": "--version"
                },
                {
                    "name": "-h --help",
                    "content": "Display help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                }
            ]
        },
        "BUGS": {
            "content": "All generic options must precede and not be combined with filesystem-specific options. Some\nfilesystem-specific programs do not automatically detect the device size and require the size\nparameter to be specified.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "David Engel <david@ods.com>, Fred N. van Kempen <waltje@uwalt.nl.mugnet.org>, Ron Sommeling\n<sommel@sci.kun.nl>.\n\nThe manual page was shamelessly adapted from Remy Card’s version for the ext2 filesystem.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "fs(5), badblocks(8), fsck(8), mkdosfs(8), mke2fs(8), mkfs.bfs(8), mkfs.ext2(8), mkfs.ext3(8),\nmkfs.ext4(8), mkfs.minix(8), mkfs.msdos(8), mkfs.vfat(8), mkfs.xfs(8)\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The mkfs command is part of the util-linux package which can be downloaded from Linux Kernel\nArchive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-06-02                                      MKFS(8)",
            "subsections": []
        }
    },
    "summary": "mkfs - build a Linux filesystem",
    "flags": [
        {
            "flag": "-t",
            "long": "--type",
            "arg": null,
            "description": "Specify the type of filesystem to be built. If not specified, the default filesystem type (currently ext2) is used. fs-options Filesystem-specific options to be passed to the real filesystem builder."
        },
        {
            "flag": "-V",
            "long": "--verbose",
            "arg": null,
            "description": "Produce verbose output, including all filesystem-specific commands that are executed. Specifying this option more than once inhibits execution of any filesystem-specific commands. This is really only useful for testing."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Display version information and exit. (Option -V will display version information only when it is the only parameter, otherwise it will work as --verbose.)"
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "fs",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/fs/5/json"
        },
        {
            "name": "badblocks",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/badblocks/8/json"
        },
        {
            "name": "fsck",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fsck/8/json"
        },
        {
            "name": "mkdosfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkdosfs/8/json"
        },
        {
            "name": "mke2fs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mke2fs/8/json"
        },
        {
            "name": "mkfs.bfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.bfs/8/json"
        },
        {
            "name": "mkfs.ext2",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.ext2/8/json"
        },
        {
            "name": "mkfs.ext3",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.ext3/8/json"
        },
        {
            "name": "mkfs.ext4",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.ext4/8/json"
        },
        {
            "name": "mkfs.minix",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.minix/8/json"
        },
        {
            "name": "mkfs.msdos",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.msdos/8/json"
        },
        {
            "name": "mkfs.vfat",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.vfat/8/json"
        },
        {
            "name": "mkfs.xfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs.xfs/8/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Build a Linux filesystem on a hard disk partition.",
        "examples": [
            {
                "description": "Build a Linux ext2 filesystem on a partition",
                "command": "sudo mkfs {{/dev/sdXY}}"
            },
            {
                "description": "Build a filesystem of a specified type",
                "command": "sudo mkfs {{-t|--type}} {{ext4}} {{/dev/sdXY}}"
            },
            {
                "description": "Build a filesystem of a specified type and check for bad blocks",
                "command": "sudo mkfs -c {{-t|--type}} {{ntfs}} {{/dev/sdXY}}"
            }
        ]
    }
}