{
    "mode": "man",
    "parameter": "mkfs.btrfs",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/mkfs.btrfs/8/json",
    "generated": "2026-06-02T23:26:50Z",
    "synopsis": "mkfs.btrfs [options] <device> [<device>...]",
    "sections": {
        "NAME": {
            "content": "mkfs.btrfs - create a btrfs filesystem\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "mkfs.btrfs [options] <device> [<device>...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "mkfs.btrfs is used to create the btrfs filesystem on a single or multiple devices. <device>\nis typically a block device but can be a file-backed image as well. Multiple devices are\ngrouped by UUID of the filesystem.\n\nBefore mounting such filesystem, the kernel module must know all the devices either via\npreceding execution of btrfs device scan or using the device mount option. See section\nMULTIPLE DEVICES for more details.\n\nThe default block group profiles for data and metadata depend on number of devices and\npossibly other factors. It’s recommended to use specific profiles but the defaults should be\nOK and allowing future conversions to other profiles. Please see options -d and -m for\nfurther detals and btrfs-balance(8) for the profile conversion post mkfs.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-b|--byte-count",
                    "content": "Specify the size of the filesystem. If this option is not used, then mkfs.btrfs uses the\nentire device space for the filesystem.\n\n--csum <type>, --checksum <type>\nSpecify the checksum algorithm. Default is crc32c. Valid values are crc32c, xxhash,\nsha256 or blake2. To mount such filesystem kernel must support the checksums as well. See\nCHECKSUM ALGORITHMS in btrfs(5).\n"
                },
                {
                    "name": "-d|--data",
                    "content": "Specify the profile for the data block groups. Valid values are raid0, raid1, raid1c3,\nraid1c4, raid5, raid6, raid10 or single or dup (case does not matter).\n\nSee DUP PROFILES ON A SINGLE DEVICE for more details.\n\nOn multiple devices, the default was raid0 until version 5.7, while it is single since\nversion 5.8. You can still select raid0 manually, but it was not suitable as default.\n"
                },
                {
                    "name": "-m|--metadata",
                    "content": "Specify the profile for the metadata block groups. Valid values are raid0, raid1,\nraid1c3, raid1c4, raid5, raid6, raid10, single or dup (case does not matter).\n\nDefault on a single device filesystem is DUP and is recommended for metadata in general.\nThe duplication might not be necessary in some use cases and it’s up to the user to\nchanged that at mkfs time or later. This depends on hardware that could potentially\ndeduplicate the blocks again but this cannot be detected at mkfs time.\n\nNOTE\nUp to version 5.14 there was a detection of a SSD device (more precisely if it’s a\nrotational device, determined by the contents of file\n/sys/block/DEV/queue/rotational) that used to select single. This has changed in\nversion 5.15 to be always dup.\n\nNote that the rotational status can be arbitrarily set by the underlying block device\ndriver and may not reflect the true status (network block device, memory-backed SCSI\ndevices, real block device behind some additional device mapper layer, etc). It’s\nrecommended to always set the options --data/--metadata to avoid confusion and\nunexpected results.\n\nSee DUP PROFILES ON A SINGLE DEVICE for more details.\nOn multiple devices the default is raid1.\n"
                },
                {
                    "name": "-M|--mixed",
                    "content": "Normally the data and metadata block groups are isolated. The mixed mode will remove the\nisolation and store both types in the same block group type. This helps to utilize the\nfree space regardless of the purpose and is suitable for small devices. The separate\nallocation of block groups leads to a situation where the space is reserved for the other\nblock group type, is not available for allocation and can lead to ENOSPC state.\n\nThe recommended size for the mixed mode is for filesystems less than 1GiB. The soft\nrecommendation is to use it for filesystems smaller than 5GiB. The mixed mode may lead to\ndegraded performance on larger filesystems, but is otherwise usable, even on multiple\ndevices.\n\nThe nodesize and sectorsize must be equal, and the block group types must match.\n\nNote\nversions up to 4.2.x forced the mixed mode for devices smaller than 1GiB. This has\nbeen removed in 4.3+ as it caused some usability issues.\n"
                },
                {
                    "name": "-l|--leafsize",
                    "content": "Alias for --nodesize. Deprecated.\n"
                },
                {
                    "name": "-n|--nodesize",
                    "content": "Specify the nodesize, the tree block size in which btrfs stores metadata. The default\nvalue is 16KiB (16384) or the page size, whichever is bigger. Must be a multiple of the\nsectorsize and a power of 2, but not larger than 64KiB (65536). Leafsize always equals\nnodesize and the options are aliases.\n\nSmaller node size increases fragmentation but leads to taller b-trees which in turn leads\nto lower locking contention. Higher node sizes give better packing and less fragmentation\nat the cost of more expensive memory operations while updating the metadata blocks.\n\nNote\nversions up to 3.11 set the nodesize to 4k.\n"
                },
                {
                    "name": "-s|--sectorsize",
                    "content": "Specify the sectorsize, the minimum data block allocation unit.\n\nThe default value is the page size and is autodetected. If the sectorsize differs from\nthe page size, the created filesystem may not be mountable by the running kernel.\nTherefore it is not recommended to use this option unless you are going to mount it on a\nsystem with the appropriate page size.\n"
                },
                {
                    "name": "-L|--label",
                    "content": "Specify a label for the filesystem. The string should be less than 256 bytes and must not\ncontain newline characters.\n"
                },
                {
                    "name": "-K|--nodiscard",
                    "content": "Do not perform whole device TRIM operation on devices that are capable of that. This does\nnot affect discard/trim operation when the filesystem is mounted. Please see the mount\noption discard for that in btrfs(5).\n"
                },
                {
                    "name": "-r|--rootdir",
                    "content": "Populate the toplevel subvolume with files from rootdir. This does not require root\npermissions to write the new files or to mount the filesystem.\n\nNote\nThis option may enlarge the image or file to ensure it’s big enough to contain the\nfiles from rootdir. Since version 4.14.1 the filesystem size is not minimized. Please\nsee option --shrink if you need that functionality.\n"
                },
                {
                    "name": "--shrink",
                    "content": "Shrink the filesystem to its minimal size, only works with --rootdir option.\n\nIf the destination block device is a regular file, this option will also truncate the\nfile to the minimal size. Otherwise it will reduce the filesystem available space. Extra\nspace will not be usable unless the filesystem is mounted and resized using btrfs\nfilesystem resize.\n\nNote\nprior to version 4.14.1, the shrinking was done automatically.\n",
                    "long": "--shrink"
                },
                {
                    "name": "-O|--features",
                    "content": "A list of filesystem features turned on at mkfs time. Not all features are supported by\nold kernels. To disable a feature, prefix it with ^.\n\nSee section FILESYSTEM FEATURES for more details. To see all available features that\nmkfs.btrfs supports run:\n\nmkfs.btrfs -O list-all\n"
                },
                {
                    "name": "-R|--runtime-features",
                    "content": "A list of features that be can enabled at mkfs time, otherwise would have to be turned on\na mounted filesystem. Although no runtime feature is enabled by default, to disable a\nfeature, prefix it with ^.\n\nSee section RUNTIME FEATURES for more details. To see all available runtime features that\nmkfs.btrfs supports run:\n\nmkfs.btrfs -R list-all\n"
                },
                {
                    "name": "-f|--force",
                    "content": "Forcibly overwrite the block devices when an existing filesystem is detected. By default,\nmkfs.btrfs will utilize libblkid to check for any known filesystem on the devices.\nAlternatively you can use the wipefs utility to clear the devices.\n"
                },
                {
                    "name": "-q|--quiet",
                    "content": "Print only error or warning messages. Options --features or --help are unaffected. Resets\nany previous effects of --verbose.\n"
                },
                {
                    "name": "-U|--uuid",
                    "content": "Create the filesystem with the given UUID. The UUID must not exist on any filesystem\ncurrently present.\n"
                },
                {
                    "name": "-v|--verbose",
                    "content": "Increase verbosity level, default is 1.\n"
                },
                {
                    "name": "-V|--version",
                    "content": "Print the mkfs.btrfs version and exit.\n"
                },
                {
                    "name": "--help",
                    "content": "Print help.\n",
                    "long": "--help"
                }
            ]
        },
        "SIZE UNITS": {
            "content": "The default unit is byte. All size parameters accept suffixes in the 1024 base. The\nrecognized suffixes are: k, m, g, t, p, e, both uppercase and lowercase.\n",
            "subsections": []
        },
        "MULTIPLE DEVICES": {
            "content": "Before mounting a multiple device filesystem, the kernel module must know the association of\nthe block devices that are attached to the filesystem UUID.\n\nThere is typically no action needed from the user. On a system that utilizes a udev-like\ndaemon, any new block device is automatically registered. The rules call btrfs device scan.\n\nThe same command can be used to trigger the device scanning if the btrfs kernel module is\nreloaded (naturally all previous information about the device registration is lost).\n\nAnother possibility is to use the mount options device to specify the list of devices to scan\nat the time of mount.\n\n# mount -o device=/dev/sdb,device=/dev/sdc /dev/sda /mnt\n\n\nNote\nthat this means only scanning, if the devices do not exist in the system, mount will fail\nanyway. This can happen on systems without initramfs/initrd and root partition created\nwith RAID1/10/5/6 profiles. The mount action can happen before all block devices are\ndiscovered. The waiting is usually done on the initramfs/initrd systems.\n\nRAID5/6 has known problems and should not be used in production.\n",
            "subsections": []
        },
        "FILESYSTEM FEATURES": {
            "content": "Features that can be enabled during creation time. See also btrfs(5) section FILESYSTEM\nFEATURES.\n",
            "subsections": [
                {
                    "name": "mixed-bg",
                    "content": "(kernel support since 2.6.37)\n\nmixed data and metadata block groups, also set by option --mixed\n"
                },
                {
                    "name": "extref",
                    "content": "(default since btrfs-progs 3.12, kernel support since 3.7)\n\nincreased hardlink limit per file in a directory to 65536, older kernels supported a\nvarying number of hardlinks depending on the sum of all file name sizes that can be\nstored into one metadata block\n"
                },
                {
                    "name": "raid56",
                    "content": "(kernel support since 3.9)\n\nextended format for RAID5/6, also enabled if raid5 or raid6 block groups are selected\n"
                },
                {
                    "name": "skinny-metadata",
                    "content": "(default since btrfs-progs 3.18, kernel support since 3.10)\n\nreduced-size metadata for extent references, saves a few percent of metadata\n"
                },
                {
                    "name": "no-holes",
                    "content": "(default since btrfs-progs 5.15, kernel support since 3.14)\n\nimproved representation of file extents where holes are not explicitly stored as an\nextent, saves a few percent of metadata if sparse files are used\n"
                },
                {
                    "name": "zoned",
                    "content": "(kernel support since 5.12)\n\nzoned mode, data allocation and write friendly to zoned/SMR/ZBC/ZNS devices, see ZONED\nMODE in btrfs(5), the mode is automatically selected when a zoned device is detected\n"
                }
            ]
        },
        "RUNTIME FEATURES": {
            "content": "Features that are typically enabled on a mounted filesystem, eg. by a mount option or by an\nioctl. Some of them can be enabled early, at mkfs time. This applies to features that need to\nbe enabled once and then the status is permanent, this does not replace mount options.\n",
            "subsections": [
                {
                    "name": "quota",
                    "content": "(kernel support since 3.4)\n\nEnable quota support (qgroups). The qgroup accounting will be consistent, can be used\ntogether with --rootdir. See also btrfs-quota(8).\n"
                },
                {
                    "name": "free-space-tree",
                    "content": "(default since btrfs-progs 5.15, kernel support since 4.5)\n\nEnable the free space tree (mount option spacecache=v2) for persisting the free space\ncache.\n"
                },
                {
                    "name": "BLOCK GROUPS, CHUNKS, RAID",
                    "content": "The highlevel organizational units of a filesystem are block groups of three types: data,\nmetadata and system.\n\nDATA\nstore data blocks and nothing else\n\nMETADATA\nstore internal metadata in b-trees, can store file data if they fit into the inline limit\n\nSYSTEM\nstore structures that describe the mapping between the physical devices and the linear\nlogical space representing the filesystem\n\nOther terms commonly used:\n\nblock group, chunk\na logical range of space of a given profile, stores data, metadata or both; sometimes the\nterms are used interchangeably\n\nA typical size of metadata block group is 256MiB (filesystem smaller than 50GiB) and 1GiB\n(larger than 50GiB), for data it’s 1GiB. The system block group size is a few megabytes.\n\nRAID\na block group profile type that utilizes RAID-like features on multiple devices:\nstriping, mirroring, parity\n"
                },
                {
                    "name": "profile",
                    "content": "when used in connection with block groups refers to the allocation strategy and\nconstraints, see the section PROFILES for more details\n"
                }
            ]
        },
        "PROFILES": {
            "content": "There are the following block group types available:\n\n┌────────┬──────────────────────────────────┬─────────────┬─────────────┐\n│        │                                  │             │             │\n│Profile │ Redundancy                       │ Space       │   Min/max   │\n│        ├──────────────┬────────┬──────────┤ utilization │   devices   │\n│        │              │        │          │             │             │\n│        │    Copies    │ Parity │ Striping │             │             │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│single  │      1       │        │          │        100% │    1/any    │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│DUP     │ 2 / 1 device │        │          │         50% │ 1/any ^(see │\n│        │              │        │          │             │ note 1)     │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│RAID0   │              │        │  1 to N  │        100% │ 1/any ^(see │\n│        │              │        │          │             │ note 5)     │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│RAID1   │      2       │        │          │         50% │    2/any    │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│RAID1C3 │      3       │        │          │         33% │    3/any    │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│RAID1C4 │      4       │        │          │         25% │    4/any    │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│RAID10  │      2       │        │  1 to N  │         50% │ 2/any ^(see │\n│        │              │        │          │             │ note 5)     │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│RAID5   │      1       │   1    │ 2 to N-1 │     (N-1)/N │ 2/any ^(see │\n│        │              │        │          │             │ note 2)     │\n├────────┼──────────────┼────────┼──────────┼─────────────┼─────────────┤\n│        │              │        │          │             │             │\n│RAID6   │      1       │   2    │ 3 to N-2 │     (N-2)/N │ 3/any ^(see │\n│        │              │        │          │             │ note 3)     │\n└────────┴──────────────┴────────┴──────────┴─────────────┴─────────────┘\n\nWarning\nIt’s not recommended to create filesystems with RAID0/1/10/5/6 profiles on partitions\nfrom the same device. Neither redundancy nor performance will be improved.\n\nNote 1: DUP may exist on more than 1 device if it starts on a single device and another one\nis added. Since version 4.5.1, mkfs.btrfs will let you create DUP on multiple devices without\nrestrictions.\n\nNote 2: It’s not recommended to use 2 devices with RAID5. In that case, parity stripe will\ncontain the same data as the data stripe, making RAID5 degraded to RAID1 with more overhead.\n\nNote 3: It’s also not recommended to use 3 devices with RAID6, unless you want to get\neffectively 3 copies in a RAID1-like manner (but not exactly that).\n\nNote 4: Since kernel 5.5 it’s possible to use RAID1C3 as replacement for RAID6, higher space\ncost but reliable.\n\nNote 5: Since kernel 5.15 it’s possible to use (mount, convert profiles) RAID0 on one device\nand RAID10 on two devices.\n\nPROFILE LAYOUT\nFor the following examples, assume devices numbered by 1, 2, 3 and 4, data or metadata blocks\nA, B, C, D, with possible stripes eg. A1, A2 that would be logically A, etc. For parity\nprofiles PA and QA are parity and syndrom, associated with the given stripe. The simple\nlayouts single or DUP are left out. Actual physical block placement on devices depends on\ncurrent state of the free/allocated space and may appear random. All devices are assumed to\nbe present at the time of the blocks would have been written.\n\nRAID1\n\n┌─────────┬──────────┬──────────┬──────────┐\n│device 1 │ device 2 │ device 3 │ device 4 │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   A     │    D     │          │          │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   B     │          │          │    C     │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   C     │          │          │          │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   D     │    A     │    B     │          │\n└─────────┴──────────┴──────────┴──────────┘\n\nRAID1C3\n\n┌─────────┬──────────┬──────────┬──────────┐\n│device 1 │ device 2 │ device 3 │ device 4 │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   A     │    A     │    D     │          │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   B     │          │    B     │          │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   C     │          │    A     │    C     │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   D     │    D     │    C     │    B     │\n└─────────┴──────────┴──────────┴──────────┘\n\nRAID0\n\n┌─────────┬──────────┬──────────┬──────────┐\n│device 1 │ device 2 │ device 3 │ device 4 │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   A2    │    C3    │    A3    │    C2    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   B1    │    A1    │    D2    │    B3    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   C1    │    D3    │    B4    │    D1    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   D4    │    B2    │    C4    │    A4    │\n└─────────┴──────────┴──────────┴──────────┘\n\nRAID5\n\n┌─────────┬──────────┬──────────┬──────────┐\n│device 1 │ device 2 │ device 3 │ device 4 │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   A2    │    C3    │    A3    │    C2    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   B1    │    A1    │    D2    │    B3    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   C1    │    D3    │    PB    │    D1    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   PD    │    B2    │    PC    │    PA    │\n└─────────┴──────────┴──────────┴──────────┘\n\nRAID6\n\n┌─────────┬──────────┬──────────┬──────────┐\n│device 1 │ device 2 │ device 3 │ device 4 │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   A2    │    QC    │    QA    │    C2    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   B1    │    A1    │    D2    │    QB    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   C1    │    QD    │    PB    │    D1    │\n├─────────┼──────────┼──────────┼──────────┤\n│         │          │          │          │\n│   PD    │    B2    │    PC    │    PA    │\n└─────────┴──────────┴──────────┴──────────┘\n",
            "subsections": []
        },
        "DUP PROFILES ON A SINGLE DEVICE": {
            "content": "The mkfs utility will let the user create a filesystem with profiles that write the logical\nblocks to 2 physical locations. Whether there are really 2 physical copies highly depends on\nthe underlying device type.\n\nFor example, a SSD drive can remap the blocks internally to a single copy—thus deduplicating\nthem. This negates the purpose of increased redundancy and just wastes filesystem space\nwithout providing the expected level of redundancy.\n\nThe duplicated data/metadata may still be useful to statistically improve the chances on a\ndevice that might perform some internal optimizations. The actual details are not usually\ndisclosed by vendors. For example we could expect that not all blocks get deduplicated. This\nwill provide a non-zero probability of recovery compared to a zero chance if the single\nprofile is used. The user should make the tradeoff decision. The deduplication in SSDs is\nthought to be widely available so the reason behind the mkfs default is to not give a false\nsense of redundancy.\n\nAs another example, the widely used USB flash or SD cards use a translation layer between the\nlogical and physical view of the device. The data lifetime may be affected by frequent\nplugging. The memory cells could get damaged, hopefully not destroying both copies of\nparticular data in case of DUP.\n\nThe wear levelling techniques can also lead to reduced redundancy, even if the device does\nnot do any deduplication. The controllers may put data written in a short timespan into the\nsame physical storage unit (cell, block etc). In case this unit dies, both copies are lost.\nBTRFS does not add any artificial delay between metadata writes.\n\nThe traditional rotational hard drives usually fail at the sector level.\n\nIn any case, a device that starts to misbehave and repairs from the DUP copy should be\nreplaced! DUP is not backup.\n",
            "subsections": []
        },
        "KNOWN ISSUES": {
            "content": "SMALL FILESYSTEMS AND LARGE NODESIZE\n\nThe combination of small filesystem size and large nodesize is not recommended in general and\ncan lead to various ENOSPC-related issues during mount time or runtime.\n\nSince mixed block group creation is optional, we allow small filesystem instances with\ndiffering values for sectorsize and nodesize to be created and could end up in the following\nsituation:\n\n# mkfs.btrfs -f -n 65536 /dev/loop0\nbtrfs-progs v3.19-rc2-405-g976307c\nSee http://btrfs.wiki.kernel.org for more information.\n\nPerforming full device TRIM (512.00MiB) ...\nLabel:              (null)\nUUID:               49fab72e-0c8b-466b-a3ca-d1bfe56475f0\nNode size:          65536\nSector size:        4096\nFilesystem size:    512.00MiB\nBlock group profiles:\nData:             single            8.00MiB\nMetadata:         DUP              40.00MiB\nSystem:           DUP              12.00MiB\nSSD detected:       no\nIncompat features:  extref, skinny-metadata\nNumber of devices:  1\nDevices:\nID        SIZE  PATH\n1   512.00MiB  /dev/loop0\n\n# mount /dev/loop0 /mnt/\nmount: mount /dev/loop0 on /mnt failed: No space left on device\n\nThe ENOSPC occurs during the creation of the UUID tree. This is caused by large metadata\nblocks and space reservation strategy that allocates more than can fit into the filesystem.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "mkfs.btrfs is part of btrfs-progs. Please refer to the btrfs wiki\nhttp://btrfs.wiki.kernel.org for further details.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "btrfs(5), btrfs(8), btrfs-balance(8), wipefs(8)\n\n\n\nBtrfs v5.16.2                                02/16/2022                                MKFS.BTRFS(8)",
            "subsections": []
        }
    },
    "summary": "mkfs.btrfs - create a btrfs filesystem",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify the size of the filesystem. If this option is not used, then mkfs.btrfs uses the entire device space for the filesystem. --csum <type>, --checksum <type> Specify the checksum algorithm. Default is crc32c. Valid values are crc32c, xxhash, sha256 or blake2. To mount such filesystem kernel must support the checksums as well. See CHECKSUM ALGORITHMS in btrfs(5)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify the profile for the data block groups. Valid values are raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10 or single or dup (case does not matter). See DUP PROFILES ON A SINGLE DEVICE for more details. On multiple devices, the default was raid0 until version 5.7, while it is single since version 5.8. You can still select raid0 manually, but it was not suitable as default."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify the profile for the metadata block groups. Valid values are raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10, single or dup (case does not matter). Default on a single device filesystem is DUP and is recommended for metadata in general. The duplication might not be necessary in some use cases and it’s up to the user to changed that at mkfs time or later. This depends on hardware that could potentially deduplicate the blocks again but this cannot be detected at mkfs time. NOTE Up to version 5.14 there was a detection of a SSD device (more precisely if it’s a rotational device, determined by the contents of file /sys/block/DEV/queue/rotational) that used to select single. This has changed in version 5.15 to be always dup. Note that the rotational status can be arbitrarily set by the underlying block device driver and may not reflect the true status (network block device, memory-backed SCSI devices, real block device behind some additional device mapper layer, etc). It’s recommended to always set the options --data/--metadata to avoid confusion and unexpected results. See DUP PROFILES ON A SINGLE DEVICE for more details. On multiple devices the default is raid1."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Normally the data and metadata block groups are isolated. The mixed mode will remove the isolation and store both types in the same block group type. This helps to utilize the free space regardless of the purpose and is suitable for small devices. The separate allocation of block groups leads to a situation where the space is reserved for the other block group type, is not available for allocation and can lead to ENOSPC state. The recommended size for the mixed mode is for filesystems less than 1GiB. The soft recommendation is to use it for filesystems smaller than 5GiB. The mixed mode may lead to degraded performance on larger filesystems, but is otherwise usable, even on multiple devices. The nodesize and sectorsize must be equal, and the block group types must match. Note versions up to 4.2.x forced the mixed mode for devices smaller than 1GiB. This has been removed in 4.3+ as it caused some usability issues."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Alias for --nodesize. Deprecated."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify the nodesize, the tree block size in which btrfs stores metadata. The default value is 16KiB (16384) or the page size, whichever is bigger. Must be a multiple of the sectorsize and a power of 2, but not larger than 64KiB (65536). Leafsize always equals nodesize and the options are aliases. Smaller node size increases fragmentation but leads to taller b-trees which in turn leads to lower locking contention. Higher node sizes give better packing and less fragmentation at the cost of more expensive memory operations while updating the metadata blocks. Note versions up to 3.11 set the nodesize to 4k."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify the sectorsize, the minimum data block allocation unit. The default value is the page size and is autodetected. If the sectorsize differs from the page size, the created filesystem may not be mountable by the running kernel. Therefore it is not recommended to use this option unless you are going to mount it on a system with the appropriate page size."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify a label for the filesystem. The string should be less than 256 bytes and must not contain newline characters."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Do not perform whole device TRIM operation on devices that are capable of that. This does not affect discard/trim operation when the filesystem is mounted. Please see the mount option discard for that in btrfs(5)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Populate the toplevel subvolume with files from rootdir. This does not require root permissions to write the new files or to mount the filesystem. Note This option may enlarge the image or file to ensure it’s big enough to contain the files from rootdir. Since version 4.14.1 the filesystem size is not minimized. Please see option --shrink if you need that functionality."
        },
        {
            "flag": "",
            "long": "--shrink",
            "arg": null,
            "description": "Shrink the filesystem to its minimal size, only works with --rootdir option. If the destination block device is a regular file, this option will also truncate the file to the minimal size. Otherwise it will reduce the filesystem available space. Extra space will not be usable unless the filesystem is mounted and resized using btrfs filesystem resize. Note prior to version 4.14.1, the shrinking was done automatically."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "A list of filesystem features turned on at mkfs time. Not all features are supported by old kernels. To disable a feature, prefix it with ^. See section FILESYSTEM FEATURES for more details. To see all available features that mkfs.btrfs supports run: mkfs.btrfs -O list-all"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "A list of features that be can enabled at mkfs time, otherwise would have to be turned on a mounted filesystem. Although no runtime feature is enabled by default, to disable a feature, prefix it with ^. See section RUNTIME FEATURES for more details. To see all available runtime features that mkfs.btrfs supports run: mkfs.btrfs -R list-all"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Forcibly overwrite the block devices when an existing filesystem is detected. By default, mkfs.btrfs will utilize libblkid to check for any known filesystem on the devices. Alternatively you can use the wipefs utility to clear the devices."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print only error or warning messages. Options --features or --help are unaffected. Resets any previous effects of --verbose."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Create the filesystem with the given UUID. The UUID must not exist on any filesystem currently present."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Increase verbosity level, default is 1."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print the mkfs.btrfs version and exit."
        },
        {
            "flag": "",
            "long": "--help",
            "arg": null,
            "description": "Print help."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "btrfs",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/btrfs/5/json"
        },
        {
            "name": "btrfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/btrfs/8/json"
        },
        {
            "name": "btrfs-balance",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/btrfs-balance/8/json"
        },
        {
            "name": "wipefs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/wipefs/8/json"
        },
        {
            "name": "MKFS.BTRFS",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/MKFS.BTRFS/8/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Create a BTRFS filesystem.",
        "examples": [
            {
                "description": "Create a Btrfs filesystem on an empty partition",
                "command": "sudo mkfs.btrfs {{/dev/sdXY}}"
            },
            {
                "description": "Create a btrfs filesystem on a single device",
                "command": "sudo mkfs.btrfs {{-m|--metadata}} single {{-d|--data}} single {{/dev/sdX}}"
            },
            {
                "description": "Create a btrfs filesystem on multiple devices with raid1",
                "command": "sudo mkfs.btrfs {{-m|--metadata}} raid1 {{-d|--data}} raid1 {{/dev/sdX /dev/sdY /dev/sdZ ...}}"
            },
            {
                "description": "Set a label for the filesystem",
                "command": "sudo mkfs.btrfs {{-L|--label}} \"{{label}}\" {{/dev/sdX /dev/sdY ...}}"
            },
            {
                "description": "Overwrite existing filesystem if one is detected",
                "command": "sudo mkfs.btrfs {{-f|--force}} {{/dev/sdX}}"
            }
        ]
    }
}