{
    "content": [
        {
            "type": "text",
            "text": "# mkfs.btrfs (man)\n\n## NAME\n\nmkfs.btrfs - create a btrfs filesystem\n\n## SYNOPSIS\n\nmkfs.btrfs [options] <device> [<device>...]\n\n## DESCRIPTION\n\nmkfs.btrfs  is  used to create the btrfs filesystem on a single or multiple devices.  The de‐\nvice is typically a block device but can be a file-backed image as well. Multiple devices are\ngrouped by UUID of the filesystem.\n\n## TLDR\n\n> Create a BTRFS filesystem.\n\n- Create a Btrfs filesystem on an empty partition:\n  `sudo mkfs.btrfs {{/dev/sdXY}}`\n- Create a btrfs filesystem on a single device:\n  `sudo mkfs.btrfs {{-m|--metadata}} single {{-d|--data}} single {{/dev/sdX}}`\n- Create a btrfs filesystem on multiple devices with raid1:\n  `sudo mkfs.btrfs {{-m|--metadata}} raid1 {{-d|--data}} raid1 {{/dev/sdX /dev/sdY /dev/sdZ ...}}`\n- Set a label for the filesystem:\n  `sudo mkfs.btrfs {{-L|--label}} \"{{label}}\" {{/dev/sdX /dev/sdY ...}}`\n- Overwrite existing filesystem if one is detected:\n  `sudo mkfs.btrfs {{-f|--force}} {{/dev/sdX}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (18 subsections)\n- **SIZE UNITS**\n- **MULTIPLE DEVICES** (2 subsections)\n- **FILESYSTEM FEATURES** (8 subsections)\n- **PROFILES**\n- **AVAILABILITY**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "mkfs.btrfs",
        "section": "",
        "mode": "man",
        "summary": "mkfs.btrfs - create a btrfs filesystem",
        "synopsis": "mkfs.btrfs [options] <device> [<device>...]",
        "tldr_summary": "Create a BTRFS filesystem.",
        "tldr_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}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Specify the size of each device as seen by the filesystem. If not set, the entire de‐ vice size is used. The total filesystem size will be sum of all device sizes, for a single device filesystem the option effectively specifies the size of 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 section 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 section 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 gen‐ eral. 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/rota‐ tional) 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 de‐ vice driver and may not reflect the true status (network block device, mem‐ ory-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 section 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 uti‐ lize 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 multi‐ ple 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. Mixed profile cannot be used together with other profiles. It can only be set at creation time. Conversion to or from mixed profile is not implemented."
            },
            {
                "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 meta‐ data blocks. NOTE: Versions up to 3.11 set the nodesize to 4KiB."
            },
            {
                "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": "Forcibly overwrite the block devices when an existing filesystem is detected. By de‐ fault, mkfs.btrfs will utilize libblkid to check for any known filesystem on the de‐ vices. 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. For a single-device filesystem, you can du‐ plicate the UUID. However, for a multi-device filesystem, the UUID must not already exist on any currently present filesystem. --device-uuid <UUID> Create the filesystem with the given device-uuid UUID (also known as UUIDSUB in blkid). For a single device filesystem, you can duplicate the device-uuid. However, used for a multi-device filesystem this option will not work at the moment."
            },
            {
                "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. --help Print help."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Removed in 6.0, used to be alias for --nodesize."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Removed in 6.3, was used to specify features not affecting on-disk format. Now all such features are merged into -O|--features option. The option -R will stay for back‐ ward compatibility."
            }
        ],
        "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"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-b|--byte-count <size>",
                        "lines": 9
                    },
                    {
                        "name": "-d|--data <profile>",
                        "lines": 8
                    },
                    {
                        "name": "-m|--metadata <profile>",
                        "lines": 24
                    },
                    {
                        "name": "-M|--mixed",
                        "lines": 21
                    },
                    {
                        "name": "-n|--nodesize <size>",
                        "lines": 13
                    },
                    {
                        "name": "-s|--sectorsize <size>",
                        "lines": 7
                    },
                    {
                        "name": "-L|--label <string>",
                        "lines": 3
                    },
                    {
                        "name": "-K|--nodiscard",
                        "lines": 4
                    },
                    {
                        "name": "-r|--rootdir <rootdir>",
                        "lines": 8
                    },
                    {
                        "name": "--shrink",
                        "lines": 10,
                        "long": "--shrink"
                    },
                    {
                        "name": "-O|--features <feature1>[,<feature2>...]",
                        "lines": 8
                    },
                    {
                        "name": "-f|--force",
                        "lines": 4
                    },
                    {
                        "name": "-q|--quiet",
                        "lines": 3
                    },
                    {
                        "name": "-U|--uuid <UUID>",
                        "lines": 9
                    },
                    {
                        "name": "-v|--verbose",
                        "lines": 2
                    },
                    {
                        "name": "-V|--version",
                        "lines": 4
                    },
                    {
                        "name": "-l|--leafsize <size>",
                        "lines": 2
                    },
                    {
                        "name": "-R|--runtime-features <feature1>[,<feature2>...]",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "SIZE UNITS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "MULTIPLE DEVICES",
                "lines": 14,
                "subsections": [
                    {
                        "name": "NOTE:",
                        "lines": 5
                    },
                    {
                        "name": "WARNING:",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "FILESYSTEM FEATURES",
                "lines": 3,
                "subsections": [
                    {
                        "name": "mixed-bg",
                        "lines": 14
                    },
                    {
                        "name": "skinny-metadata",
                        "lines": 4
                    },
                    {
                        "name": "no-holes",
                        "lines": 15
                    },
                    {
                        "name": "free-space-tree",
                        "lines": 12
                    },
                    {
                        "name": "block-group-tree",
                        "lines": 10
                    },
                    {
                        "name": "raid-stripe-tree",
                        "lines": 28
                    },
                    {
                        "name": "block group, chunk",
                        "lines": 10
                    },
                    {
                        "name": "profile",
                        "lines": 3
                    }
                ]
            },
            {
                "name": "PROFILES",
                "lines": 192,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            }
        ],
        "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.  The de‐\nvice is 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  pre‐\nceding  execution of btrfs device scan or using the device mount option. See section MULTIPLE\nDEVICES for more details.\n\nThe default block group profiles for data and metadata depend on number of devices and possi‐\nbly other factors. It's recommended to use specific profiles but the defaults  should  be  OK\nand  allowing future conversions to other profiles.  Please see options -d and -m for further\ndetails and btrfs-balance(8) for the profile conversion post mkfs.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-b|--byte-count <size>",
                        "content": "Specify the size of each device as seen by the filesystem. If not set, the entire  de‐\nvice  size  is  used. The total filesystem size will be sum of all device sizes, for a\nsingle device filesystem the option effectively specifies the size of 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.\nSee section CHECKSUM ALGORITHMS in btrfs(5).\n"
                    },
                    {
                        "name": "-d|--data <profile>",
                        "content": "Specify the profile for the  data  block  groups.   Valid  values  are  raid0,  raid1,\nraid1c3, raid1c4, raid5, raid6, raid10 or single or dup (case does not matter).\n\nSee section 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 <profile>",
                        "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  gen‐\neral. The duplication might not be necessary in some use cases and it's up to the user\nto changed 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  /sys/block/DEV/queue/rota‐\ntional)  that  used to select single. This has changed in version 5.15 to be always\ndup.\n\nNote that the rotational status can be arbitrarily set by the underlying block  de‐\nvice  driver  and  may  not  reflect  the  true  status (network block device, mem‐\nory-backed SCSI devices, real block device behind  some  additional  device  mapper\nlayer,  etc). It's recommended to always set the options --data/--metadata to avoid\nconfusion and unexpected results.\n\nSee section DUP PROFILES ON A SINGLE DEVICE for more details.\n\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\nthe  isolation  and store both types in the same block group type.  This helps to uti‐\nlize the free space regardless of the purpose and is suitable for small  devices.  The\nseparate  allocation  of block groups leads to a situation where the space is reserved\nfor the other block group type, is not available for allocation and can lead to ENOSPC\nstate.\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\nto degraded performance on larger filesystems, but is otherwise usable, even on multi‐\nple devices.\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\nMixed  profile  cannot  be used together with other profiles. It can only be set at\ncreation time. Conversion to or from mixed profile is not implemented.\n"
                    },
                    {
                        "name": "-n|--nodesize <size>",
                        "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\nthe sectorsize and a power of 2, but not larger than 64KiB (65536).   Leafsize  always\nequals nodesize and the options are aliases.\n\nSmaller  node  size  increases fragmentation but leads to taller b-trees which in turn\nleads to lower locking contention. Higher node sizes  give  better  packing  and  less\nfragmentation at the cost of more expensive memory operations while updating the meta‐\ndata blocks.\n\nNOTE:\nVersions up to 3.11 set the nodesize to 4KiB.\n"
                    },
                    {
                        "name": "-s|--sectorsize <size>",
                        "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\na system with the appropriate page size.\n"
                    },
                    {
                        "name": "-L|--label <string>",
                        "content": "Specify a label for the filesystem. The string should be less than 256 bytes and  must\nnot contain newline characters.\n"
                    },
                    {
                        "name": "-K|--nodiscard",
                        "content": "Do  not perform whole device TRIM operation on devices that are capable of that.  This\ndoes not affect discard/trim operation when the filesystem is mounted.  Please see the\nmount option discard for that in btrfs(5).\n"
                    },
                    {
                        "name": "-r|--rootdir <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.\nPlease see 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.\nExtra  space  will  not  be  usable unless the filesystem is mounted and resized using\nbtrfs filesystem resize.\n\nNOTE:\nPrior to version 4.14.1, the shrinking was done automatically.\n",
                        "long": "--shrink"
                    },
                    {
                        "name": "-O|--features <feature1>[,<feature2>...]",
                        "content": "A list of filesystem features turned on at mkfs time. Not all features  are  supported\nby old 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\n$ mkfs.btrfs -O list-all\n"
                    },
                    {
                        "name": "-f|--force",
                        "content": "Forcibly overwrite the block devices when an existing filesystem is detected.  By  de‐\nfault,  mkfs.btrfs  will utilize libblkid to check for any known filesystem on the de‐\nvices. Alternatively 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.\nResets any previous effects of --verbose.\n"
                    },
                    {
                        "name": "-U|--uuid <UUID>",
                        "content": "Create the filesystem with the given UUID. For a single-device filesystem, you can du‐\nplicate  the  UUID.  However, for a multi-device filesystem, the UUID must not already\nexist on any currently present filesystem.\n\n--device-uuid <UUID>\nCreate the filesystem with the given device-uuid  UUID  (also  known  as  UUIDSUB  in\nblkid).   For  a single device filesystem, you can duplicate the device-uuid. However,\nused for a multi-device filesystem this option will not work at the moment.\n"
                    },
                    {
                        "name": "-v|--verbose",
                        "content": "Increase verbosity level, default is 1.\n"
                    },
                    {
                        "name": "-V|--version",
                        "content": "Print the mkfs.btrfs version and exit.\n\n--help Print help.\n"
                    },
                    {
                        "name": "-l|--leafsize <size>",
                        "content": "Removed in 6.0, used to be alias for --nodesize.\n"
                    },
                    {
                        "name": "-R|--runtime-features <feature1>[,<feature2>...]",
                        "content": "Removed in 6.3, was used to specify features not affecting on-disk  format.   Now  all\nsuch  features are merged into -O|--features option. The option -R will stay for back‐\nward compatibility.\n"
                    }
                ]
            },
            "SIZE UNITS": {
                "content": "The default unit is byte. All size parameters accept suffixes in the 1024  base.  The  recog‐\nnized 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 re‐\nloaded (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",
                "subsections": [
                    {
                        "name": "NOTE:",
                        "content": "This  means only scanning, if the devices do not exist in the system, mount will fail any‐\nway. This can happen on systems without initramfs/initrd and root partition  created  with\nRAID1/10/5/6  profiles.  The  mount action can happen before all block devices are discov‐\nered. The waiting is usually done on the initramfs/initrd systems.\n"
                    },
                    {
                        "name": "WARNING:",
                        "content": "RAID5/6 has known problems and should not be used in production.\n"
                    }
                ]
            },
            "FILESYSTEM FEATURES": {
                "content": "Features that can be enabled during creation time. See also btrfs(5) section FILESYSTEM  FEA‐\nTURES.\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\nextref (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\nraid56 (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\nzoned  (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\nquota  (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  in  a  b-tree. This is built on top of the COW mechanism and has better perfor‐\nmance than v1.\n\nOffline conversion from filesystems that don't have this feature enabled at mkfs  time\nis possible, see btrfstune(8).\n\nOnline  conversion  can be done by mounting with spacecache=v2, this is sufficient to\nbe done one time.\n"
                    },
                    {
                        "name": "block-group-tree",
                        "content": "(kernel support since 6.1)\n\nEnable a dedicated b-tree for block group items, this greatly reduces mount  time  for\nlarge  filesystems  due to better data locality that avoids seeking. On rotational de‐\nvices the large size is considered starting from the 2-4TiB.  Can  be  used  on  other\ntypes of devices (SSD, NVMe, ...) as well.\n\nOffline  conversion from filesystems that don't have this feature enabled at mkfs time\nis possible, see btrfstune(8). Online conversion is not possible.\n"
                    },
                    {
                        "name": "raid-stripe-tree",
                        "content": "(kernel support since 6.7)\n\nNew tree for logical file extent mapping where the physical mapping may not  match  on\nmultiple  devices.  this is now used in zoned mode to implement RAID0/RAID1* profiles,\nbut can be used in non-zoned mode as well. The support for RAID56  is  in  development\nand  will eventually fix the problems with the current implementation. This is a back‐\nward incompatible feature and has to be enabled at mkfs time.\n\nsquota (kernel support since 6.7)\n\nEnable simple quota accounting (squotas). This is an alternative  to  qgroups  with  a\nsmaller performance impact but no notion of shared vs.  exclusive usage.\n\nBLOCK GROUPS, CHUNKS, RAID\nThe  highlevel  organizational  units  of a filesystem are block groups of three types: data,\nmetadata and system.\n\nDATA   store data blocks and nothing else\n\nMETADATA\nstore internal metadata in b-trees, can store file data if they fit  into  the  inline\nlimit\n\nSYSTEM store structures that describe the mapping between the physical devices and the linear\nlogical space representing the filesystem\n\nOther terms commonly used:\n"
                    },
                    {
                        "name": "block group, chunk",
                        "content": "a  logical range of space of a given profile, stores data, metadata or both; sometimes\nthe terms are used interchangeably\n\nA typical size of metadata block group is 256MiB (filesystem smaller than  50GiB)  and\n1GiB  (larger  than  50GiB),  for data it's 1GiB. The system block group size is a few\nmegabytes.\n\nRAID   a 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 con‐\nstraints, see the section PROFILES for more details\n"
                    }
                ]
            },
            "PROFILES": {
                "content": "There are the following block group types available:\n───────────────────────────────────────────────────────────────────────────────────────\nProfiles   Redundancy     Redundancy   Redundancy   Space utiliza‐   Min/max    de‐\ntion             vices\nCopies         Parity       Striping\n───────────────────────────────────────────────────────────────────────────────────────\nsingle     1                                        100%             1/any\n───────────────────────────────────────────────────────────────────────────────────────\nDUP        2 / 1 device                             50%              1/any     (see\nnote 1)\n───────────────────────────────────────────────────────────────────────────────────────\nRAID0      1                           1 to N       100%             1/any     (see\nnote 5)\n───────────────────────────────────────────────────────────────────────────────────────\nRAID1      2                                        50%              2/any\n───────────────────────────────────────────────────────────────────────────────────────\nRAID1C3    3                                        33%              3/any\n───────────────────────────────────────────────────────────────────────────────────────\nRAID1C4    4                                        25%              4/any\n───────────────────────────────────────────────────────────────────────────────────────\nRAID10     2                           1 to N       50%              2/any     (see\nnote 5)\n───────────────────────────────────────────────────────────────────────────────────────\nRAID5      1              1            2 to N-1     (N-1)/N          2/any     (see\nnote 2)\n───────────────────────────────────────────────────────────────────────────────────────\nRAID6      1              2            3 to N-2     (N-2)/N          3/any     (see\nnote 3)\n───────────────────────────────────────────────────────────────────────────────────────\n│          │              │            │            │                │                │\nWA│RNING:     │              │            │            │                │                │\n│It's not r│ecommended to c│reate filesys│tems with RAI│D0/1/10/5/6 profi│les on partitions│from\n│the same d│evice.  Neither│redundancy n│or performanc│e will be improve│d.               │\n│          │              │            │            │                │                │\nNo│te 1: DUP m│ay exist on mor│e than 1 devi│ce if it star│ts on a single de│vice and  another│ one\nis│added. Sin│ce version 4.5.│1, mkfs.btrfs│will let you│create DUP on mu│ltiple devices wi│thout\nre│strictions.│              │            │            │                │                │\n│          │              │            │            │                │                │\nNo│te  2:  It'│s  not recommen│ded to use 2 │devices with │RAID5. In that ca│se, parity stripe│will\nco│ntain the s│ame data as the│data stripe,│making RAID5│degraded to RAID│1 with more overh│ead.\n│          │              │            │            │                │                │\nNo│te 3: It's │also not recomm│ended to use │3 devices wit│h RAID6, unless y│ou want to get  e│ffec‐\nti│vely 3 copi│es in a RAID1-l│ike manner (b│ut not exactl│y that).         │                │\n│          │              │            │            │                │                │\nNo│te  4: Sinc│e kernel 5.5 it│'s possible t│o use RAID1C3│as replacement f│or RAID6, higher │space\nco│st but reli│able.          │            │            │                │                │\n│          │              │            │            │                │                │\nNo│te 5: Since│kernel 5.15 it│'s possible t│o use (mount,│convert profiles│) RAID0 on one  d│evice\nan│d RAID10 on│two devices.  │            │            │                │                │\n│          │              │            │            │                │                │\nPROFIL│E LAYOUT   │              │            │            │                │                │\nFo│r the follo│wing examples, │assume device│s numbered by│1, 2, 3 and 4, d│ata or metadata b│locks\nA,│B, C, D, w│ith possible st│ripes e.g. A1│, A2 that wou│ld be logically A│, etc. For parity│pro‐\nfi│les  PA  an│d QA are parity│and syndrome│, associated │with the given st│ripe.  The simple│lay‐\nou│ts single o│r DUP are left │out.  Actual │physical bloc│k placement on de│vices depends on │cur‐\nre│nt  state  │of the free/all│ocated space │and may appea│r random. All dev│ices are assumed │to be\npr│esent at th│e time of the b│locks would h│ave been writ│ten.             │                │\n│          │              │            │            │                │                │\nRAID1 │          │              │            │            │                │                │\n│          │         ┌────┼─────┬──────┼───┬────────┼─┬──────────┐   │                │\n│          │         │ dev│ice 1 │ devic│e 2 │ device │3 │ device 4 │   │                │\n│          │         ├────┼─────┼──────┼───┼────────┼─┼──────────┤   │                │\n│          │         │ A  │     │ D    │   │        │ │          │   │                │\n│          │         ├────┼─────┼──────┼───┼────────┼─┼──────────┤   │                │\n│          │         │ B  │     │      │   │        │ │ C        │   │                │\n│          │         ├────┼─────┼──────┼───┼────────┼─┼──────────┤   │                │\n│          │         │ C  │     │      │   │        │ │          │   │                │\n│          │         ├────┼─────┼──────┼───┼────────┼─┼──────────┤   │                │\n│          │         │ D  │     │ A    │   │ B      │ │          │   │                │\n│          │         └────┼─────┴──────┼───┴────────┼─┴──────────┘   │                │\n│          │              │            │            │                │                │\nRAID1C│3          │              │            │            │                │                │\n┌──────────┬──────────┬──────────┬──────────┐\n│ device 1 │ device 2 │ device 3 │ device 4 │\n├──────────┼──────────┼──────────┼──────────┤\n│ A        │ A        │ D        │          │\n├──────────┼──────────┼──────────┼──────────┤\n│ B        │          │ B        │          │\n├──────────┼──────────┼──────────┼──────────┤\n│ C        │          │ A        │ C        │\n├──────────┼──────────┼──────────┼──────────┤\n│ D        │ D        │ C        │ B        │\n└──────────┴──────────┴──────────┴──────────┘\n\nRAID0\n┌──────────┬──────────┬──────────┬──────────┐\n│ device 1 │ device 2 │ device 3 │ device 4 │\n├──────────┼──────────┼──────────┼──────────┤\n│ A2       │ C3       │ A3       │ C2       │\n├──────────┼──────────┼──────────┼──────────┤\n│ B1       │ A1       │ D2       │ B3       │\n├──────────┼──────────┼──────────┼──────────┤\n│ C1       │ D3       │ B4       │ D1       │\n├──────────┼──────────┼──────────┼──────────┤\n│ D4       │ B2       │ C4       │ A4       │\n└──────────┴──────────┴──────────┴──────────┘\n\nRAID5\n─────────────────────────────────────────────\ndevice 1   device 2   device 3   device 4\n─────────────────────────────────────────────\nA2         C3         A3         C2\n─────────────────────────────────────────────\nB1         A1         D2         B3\n─────────────────────────────────────────────\nC1         D3         PB         D1\n─────────────────────────────────────────────\nPD         B2         PC         PA\n┌──────────┬──────────┬──────────┬──────────┐\n│          │          │          │          │\nRAID6                      │          │          │          │          │\n├──────────┼──────────┼──────────┼──────────┤\n│ device 1 │ device 2 │ device 3 │ device 4 │\n├──────────┼──────────┼──────────┼──────────┤\n│ A2       │ QC       │ QA       │ C2       │\n├──────────┼──────────┼──────────┼──────────┤\n│ B1       │ A1       │ D2       │ QB       │\n├──────────┼──────────┼──────────┼──────────┤\n│ C1       │ QD       │ PB       │ D1       │\n├──────────┼──────────┼──────────┼──────────┤\n│ PD       │ B2       │ PC       │ PA       │\n├──────────┼──────────┼──────────┼──────────┤\n│          │          │          │          │\nDUP PROFILES ON A SINGLE DEVIC│E          │          │          │          │\nThe mkfs utility will l│et the user│create a f│ilesystem w│ith profile│s that write  the  logical\nblocks  to 2 physical l│ocations. W│hether ther│e are reall│y 2 physica│l copies highly depends on\nthe underlying device t│ype.       │          │          │          │\n│          │          │          │          │\nFor example, a SSD driv│e can remap│the blocks│internally│to a singl│e copy--thus deduplicating\nthem. This negates the │purpose of │increased r│edundancy a│nd just was│tes filesystem space with‐\nout providing the expec│ted level o│f redundanc│y.         │          │\n│          │          │          │          │\nThe duplicated data/met│adata may s│till be use│ful to stat│istically i│mprove the  chances  on  a\ndevice  that  might  pe│rform  some│internal o│ptimization│s. The actu│al details are not usually\ndisclosed by vendors. F│or example │we could ex│pect that n│ot all bloc│ks get deduplicated.  This\nwill  provide a non-zer│o probabili│ty of recov│ery compare│d to a zero│chance if the single pro‐\nfile is used. The user │should make│the  trade│off  decisi│on.  The  d│eduplication  in  SSDs  is\nthought  to  be widely │available s│o the reaso│n behind th│e mkfs defa│ult is to not give a false\nsense of redundancy.   │          │          │          │          │\n│          │          │          │          │\nAs another example, the│widely use│d USB flash│or SD card│s use a tra│nslation layer between the\nlogical and physical vi│ew of the d│evice. The │data lifeti│me may be a│ffected by frequent  plug‐\nging.  The memory cells│could get │damaged, ho│pefully not│destroying│both copies of particular\ndata in case of DUP.   │          │          │          │          │\n│          │          │          │          │\nThe wear levelling tech│niques can │also lead t│o reduced r│edundancy, │even if  the  device  does\nnot  do  any deduplicat│ion. The co│ntrollers m│ay put data│written in│a short timespan into the\nsame physical storage u│nit (cell, │block etc).│In case th│is unit die│s, both copies  are  lost.\nBTRFS does not add any │artificial │delay betwe│en metadata│writes.   │\n│          │          │          │          │\nThe traditional rotatio│nal hard dr│ives usuall│y fail at t│he sector l│evel.\n│          │          │          │          │\nIn  any  case,  a devic│e that star│ts to misbe│have and re│pairs from │the DUP copy should be re‐\nplaced! DUP is not back│up.        │          │          │          │\n│          │          │          │          │\nKNOWN ISSUES                  │          │          │          │          │\nSMALL FILESYSTEMS AND L│ARGE NODESI│ZE         │          │          │\n│          │          │          │          │\nThe combination of smal│l filesyste│m size and │large nodes│ize is not │recommended in general and\ncan lead to various ENO│SPC-related│issues dur│ing mount t│ime or runt│ime.\n│          │          │          │          │\nSince mixed block group│creation i│s optional,│we allow s│mall filesy│stem instances  with  dif‐\nfering  values  for  se│ctorsize  a│nd nodesize│to be crea│ted and cou│ld end up in the following\nsituation:             │          │          │          │          │\n│          │          │          │          │\n# mkfs.btrfs -f -n 6│5536 /dev/l│oop0       │          │          │\nbtrfs-progs v3.19-rc│2-405-g9763│07c        │          │          │\nSee https://btrfs.re│adthedocs.i│o for more │information│.          │\n│          │          │          │          │\nPerforming full devi│ce TRIM (51│2.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": "btrfs    is    part    of    btrfs-progs.     Please    refer   to   the   documentation   at\nhttps://btrfs.readthedocs.io.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "btrfs(5), btrfs(8), btrfs-balance(8), wipefs(8)\n\n\n6.6.3                                       Mar 31, 2024                               MKFS.BTRFS(8)",
                "subsections": []
            }
        }
    }
}