-b|--byte-count
<size>
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).
-d|--data
<profile>
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.
-m|--metadata
<profile>
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, unless an SSD
is detected, in which case it will default to single. The
detection is based on the value of
/sys/block/DEV/queue/rotational
, where DEV is the short name
of the device.
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
etc). It's recommended to options --data/--metadata to avoid
confusion.
See DUP PROFILES ON A SINGLE DEVICE for more details.
On multiple devices the default is raid1.
-M|--mixed
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.
-l|--leafsize
<size>
Alias for --nodesize. Deprecated.
-n|--nodesize
<size>
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.
-s|--sectorsize
<size>
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.
-L|--label
<string>
Specify a label for the filesystem. The string should be less
than 256 bytes and must not contain newline characters.
-K|--nodiscard
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).
-r|--rootdir
<rootdir>
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.
--shrink
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.
-O|--features
<feature1>[,
<feature2>...]
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
-R|--runtime-features
<feature1>[,
<feature2>...]
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
-f|--force
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.
-q|--quiet
Print only error or warning messages. Options --features or
--help are unaffected.
-U|--uuid
<UUID>
Create the filesystem with the given UUID. The UUID must not
exist on any filesystem currently present.
-V|--version
Print the mkfs.btrfs
version and exit.
--help
Print help.