btrfs-progs doc: emphasis that only mounted device works for btrfs device stats
[platform/upstream/btrfs-progs.git] / Documentation / mkfs.btrfs.txt
1 mkfs.btrfs(8)
2 =============
3
4 NAME
5 ----
6 mkfs.btrfs - create a btrfs filesystem
7
8 SYNOPSIS
9 --------
10 *mkfs.btrfs*
11 $$[-A|--alloc-start <alloc-start>]$$
12 $$[-b|--byte-count <byte-count>]$$
13 $$[-d|--data <data-profile>]$$
14 $$[-f|--force]$$
15 $$[-n|--nodesize <nodesize>]$$
16 $$[-l|--leafsize <leafsize>]$$
17 $$[-L|--label <label>]$$
18 $$[-m|--metadata <metadata profile>]$$
19 $$[-M|--mixed]$$
20 $$[-s|--sectorsize <sectorsize>]$$
21 $$[-r|--rootdir <rootdir>]$$
22 $$[-K|--nodiscard]$$
23 $$[-O|--features <feature1>[,<feature2>...]]$$
24 $$[-U|--uuid <UUID>]$$
25 $$[-h]$$
26 $$[-V|--version]$$
27 $$<device> [<device>...]$$
28
29 DESCRIPTION
30 -----------
31 *mkfs.btrfs*
32 is used to create a btrfs filesystem (usually in a disk partition, or an array
33 of disk partitions).
34
35 <device>
36 is the special file corresponding to the device (e.g /dev/sdXX ).
37 If multiple devices are specified, btrfs is created
38 spanning across the specified  devices.
39
40 OPTIONS
41 -------
42 -A|--alloc-start <offset>::
43 Specify the offset from the start of the device at which to start allocations
44 in this btrfs filesystem. The default value is zero, or the start of the
45 device.  This option is intended only for debugging filesystem resize
46 operations.
47
48 -b|--byte-count <size>::
49 Specify the size of the resultant filesystem. If this option is not used,
50 mkfs.btrfs uses all the available storage for the filesystem.
51
52 -d|--data <type>::
53 Specify how the data must be spanned across the devices specified. Valid
54 values are 'raid0', 'raid1', 'raid5', 'raid6', 'raid10' or 'single'.
55
56 -f|--force::
57 Force overwrite when an existing filesystem is detected on the device.
58 By default, mkfs.btrfs will not write to the device if it suspects that
59 there is a filesystem or partition table on the device already.
60
61 -l|--leafsize <size>::
62 Alias for --nodesize. Deprecated.
63
64 -n|--nodesize <size>::
65 Specify the nodesize, the tree block size in which btrfs stores
66 data. The default value is 16KB (16384) or the page size, whichever is
67 bigger. Must be a multiple of the sectorsize, but not larger than 65536.
68 Leafsize always equals nodesize and the options are aliases.
69
70 -L|--label <name>::
71 Specify a label for the filesystem.
72 +
73 NOTE: <name> should be less than 256 characters.
74
75 -m|--metadata <profile>::
76 Specify how metadata must be spanned across the devices specified. Valid
77 values are 'raid0', 'raid1', 'raid5', 'raid6', 'raid10', 'single' or 'dup'.
78 +
79 Single device
80 will have dup set by default except in the case of SSDs which will default to
81 single. This is because SSDs can remap blocks internally so duplicate blocks
82 could end up in the same erase block which negates the benefits of doing
83 metadata duplication.
84
85 -M|--mixed::
86 Mix data and metadata chunks together for more efficient space
87 utilization.  This feature incurs a performance penalty in
88 larger filesystems.  It is recommended for use with filesystems
89 of 1 GiB or smaller.
90
91 -s|--sectorsize <size>::
92 Specify the sectorsize, the minimum data block allocation unit.
93 +
94 The default
95 value is the page size. If the sectorsize differs from the page size, the
96 created filesystem may not be mountable by current kernel. Therefore it is not
97 recommended to use this option unless you are going to mount it on a system
98 with the appropriate page size.
99
100 -r|--rootdir <rootdir>::
101 Specify a directory to copy into the newly created btrfs filesystem.
102 +
103 NOTE: '-r' option is done completely in userland, and don't need root
104 privilege to mount the filesystem.
105
106 -K|--nodiscard::
107 Do not perform whole device TRIM operation by default.
108
109 -O|--features <feature1>[,<feature2>...]::
110 A list of filesystem features turned on at mkfs time. Not all features are
111 supported by old kernels.
112 +
113 To see all features run:
114 +
115 +mkfs.btrfs -O list-all+
116
117 -U|--uuid <UUID>::
118 Create the filesystem with the specified UUID, which must not already exist on
119 the system.
120
121 -V|--version::
122 Print the *mkfs.btrfs* version and exit.
123
124 -h::
125 Print help.
126
127 UNIT
128 ----
129 As default the unit is the byte, however it is possible to append a suffix
130 to the arguments like 'k' for KBytes, 'm' for MBytes...
131
132 AVAILABILITY
133 ------------
134 *btrfs* is part of btrfs-progs.
135 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
136 further details.
137
138 SEE ALSO
139 --------
140 `btrfs`(8)