Btrfs-progs: add fsck test for filesystem with shared prealloc extents
[platform/upstream/btrfs-progs.git] / Documentation / mkfs.btrfs.asciidoc
index 7d19a14..2a1c359 100644 (file)
@@ -7,25 +7,7 @@ mkfs.btrfs - create a btrfs filesystem
 
 SYNOPSIS
 --------
-*mkfs.btrfs*
-$$[-A|--alloc-start <alloc-start>]$$
-$$[-b|--byte-count <byte-count>]$$
-$$[-d|--data <data-profile>]$$
-$$[-m|--metadata <metadata profile>]$$
-$$[-M|--mixed]$$
-$$[-l|--leafsize <leafsize>]$$
-$$[-n|--nodesize <nodesize>]$$
-$$[-s|--sectorsize <sectorsize>]$$
-$$[-L|--label <label>]$$
-$$[-K|--nodiscard]$$
-$$[-r|--rootdir <rootdir>]$$
-$$[-O|--features <feature1>[,<feature2>...]]$$
-$$[-U|--uuid <UUID>]$$
-$$[-f|--force]$$
-$$[-q|--quiet]$$
-$$[--help]$$
-$$[-V|--version]$$
-$$<device> [<device>...]$$
+*mkfs.btrfs* [options] <device> [<device>...]
 
 DESCRIPTION
 -----------
@@ -39,13 +21,8 @@ mount option. See section *MULTIPLE DEVICES* for more details.
 
 OPTIONS
 -------
-*-A|--alloc-start <offset>*::
-(An option to help debugging chunk allocator.)
-Specify the (physical) offset from the start of the device at which allocations
-start.  The default value is zero.
-
 *-b|--byte-count <size>*::
-Specify the size of the filesystem. If this option is not used,
+Specify the size of the filesystem. If this option is not used, then
 mkfs.btrfs uses the entire device space for the filesystem.
 
 *-d|--data <profile>*::
@@ -94,10 +71,10 @@ 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, but not larger than 64KiB (65536).  Leafsize always
-equals nodesize and the options are aliases.
+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 lead to higher b-trees which in
+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.
@@ -118,10 +95,26 @@ 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 and does not mount the filesystem.
+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 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
@@ -151,6 +144,12 @@ Print the *mkfs.btrfs* version and exit.
 *--help*::
 Print help.
 
+*-A|--alloc-start <offset>*::
+*deprecated, will be removed*
+(An option to help debugging chunk allocator.)
+Specify the (physical) offset from the start of the device at which allocations
+start.  The default value is zero.
+
 SIZE UNITS
 ----------
 The default unit is 'byte'. All size parameters accept suffixes in the 1024
@@ -182,6 +181,9 @@ root partition created with RAID1/10/5/6 profiles. The mount action can happen
 before all block devices are discovered. The waiting is usually done on the
 initramfs/initrd systems.
 
+As of kernel 4.14, RAID5/6 is still considered experimental and shouldn't be
+employed for production use.
+
 FILESYSTEM FEATURES
 -------------------
 
@@ -271,6 +273,10 @@ There are the following block group types available:
 | RAID6   | 1            | 2              | 3 to N - 2 | 3/any ^(see note 3)^
 |=============================================================
 
+WARNING: It's not recommended to build btrfs with RAID0/1/10/5/6 profiles on
+partitions from the same device.  Neither redundancy nor performance will be
+improved.
+
 'Note 1:' DUP may exist on more than 1 device if it starts on a single device and
 another one is added. Since version 4.5.1, *mkfs.btrfs* will let you create DUP
 on multiple devices.
@@ -290,9 +296,9 @@ The mkfs utility will let the user create a filesystem with profiles that write
 the logical blocks to 2 physical locations. Whether there are really 2
 physical copies highly depends on the underlying device type.
 
-For example, a SSD drive can remap the blocks internally to a single copy thus
+For example, a SSD drive can remap the blocks internally to a single copy--thus
 deduplicating them. This negates the purpose of increased redundancy and just
-wastes filesystem space without the expected level of redundancy.
+wastes filesystem space without providing the expected level of redundancy.
 
 The duplicated data/metadata may still be useful to statistically improve the
 chances on a device that might perform some internal optimizations. The actual