6 btrfs-filesystem - control btrfs filesystem
10 *btrfs filesystem* <subcommand> <args>
14 *btrfs filesystem* is used to do the filesystem level control jobs, including
15 all the regular filesystem operations like setting/getting label,
20 *df* [options] <path>::
21 Show space usage information for a mount point.
26 raw numbers in bytes, without the 'B' suffix
27 -h|--human-readable::::
28 print human friendly numbers, base 1024, this is the default
30 print human friendly numbers, base 1000
32 select the 1024 base for the following options, according to the IEC standard
34 select the 1000 base for the following options, according to the SI standard
36 show sizes in KiB, or kB with --si
38 show sizes in MiB, or MB with --si
40 show sizes in GiB, or GB with --si
42 show sizes in TiB, or TB with --si
44 If conflicting options are passed, the last one takes precedence.
46 *defragment* [options] <file>|<dir> [<file>|<dir>...]::
47 Defragment file data and/or directory metadata *online*.
49 If '-r' is passed, files in dir will be defragmented recursively.
50 The start position and the number of bytes to defragment can be specified by
51 start and len using '-s' and '-l' options below.
52 Any extent bigger than threshold given by '-t' option, will be considered
54 Use 0 to take the kernel default.
55 You can also turn on compression in defragment operations.
62 compress file contents while defragmenting
64 defragment files recursively
66 flush filesystem after defragmenting
67 -s <start>[kKmMgGtTpPeE]::::
68 defragment only from byte <start> onward
69 -l <len>[kKmMgGtTpPeE]::::
70 defragment only up to <len> bytes
71 -t <size>[kKmMgGtTpPeE]::::
72 defragment only files at least <size> bytes big
74 For <start>, <len>, <size> it is possible to append
75 units designator: \'K', \'M', \'G', \'T', \'P', or \'E', which represent
76 KiB, MiB, GiB, TiB, PiB, or EiB, respectively. Case does not matter.
78 WARNING: defragmenting with kernels up to 2.6.37 will unlink COW-ed copies of data,
79 don't use it if you use snapshots, have de-duplicated your data or made
80 copies with `cp --reflink`.
82 *label* [<dev>|<mountpoint>] [<newlabel>]::
83 Show or update the label of a filesystem.
85 [<device>|<mountpoint>] is used to identify the filesystem.
86 If a newlabel optional argument is passed, the label is changed.
88 NOTE: the maximum allowable length shall be less than 256 chars
90 // Some wording are extracted by the resize2fs man page
91 *resize* [<devid>:][+/-]<size>[kKmMgGtTpPeE]|[<devid>:]max <path>::
92 Resize a mounted filesystem identified by directory <path>. A particular device
93 can be resized by specifying a <devid>.
95 If <path> is a file containing a btrfs image then resize does not work as
96 expected and does not resize the image. This would resize the underlying
99 The devid can be found with *btrfs filesystem show* and
100 defaults to 1 if not specified.
101 The <size> parameter specifies the new size of the filesystem.
102 If the prefix + or - is present the size is increased or decreased
103 by the quantity <size>.
104 If no units are specified, the unit of the <size> parameter defaults to
105 bytes. Optionally, the size parameter may be suffixed by one of the following
106 units designators: \'K', \'M', \'G', \'T', \'P', or \'E', which represent
107 KiB, MiB, GiB, TiB, PiB, or EiB, respectively. Case does not matter.
109 If \'max' is passed, the filesystem will occupy all available space on the
112 The resize command does not manipulate the size of underlying
113 partition. If you wish to enlarge/reduce a filesystem, you must make sure you
114 can expand the partition before enlarging the filesystem and shrink the
115 partition after reducing the size of the filesystem. This can done using
116 `fdisk`(8) or `parted`(8) to delete the existing partition and recreate
117 it with the new desired size. When recreating the partition make sure to use
118 the same starting disk cylinder as before.
120 *show* [--mounted|--all-devices|<path>|<uuid>|<device>|<label>]::
121 Show the btrfs filesystem with some additional info.
123 If no option nor <path>|<uuid>|<device>|<label> is passed, btrfs shows
124 information of all the btrfs filesystem both mounted and unmounted.
125 If '--mounted' is passed, it would probe btrfs kernel to list mounted btrfs
127 If '--all-devices' is passed, all the devices under /dev are scanned;
128 otherwise the devices list is extracted from the /proc/partitions file.
131 Force a sync for the filesystem identified by <path>.
133 *usage* [options] <path> [<path>...]::
134 Show detailed information about internal filesystem usage.
139 raw numbers in bytes, without the 'B' suffix
140 -h|--human-readable::::
141 print human friendly numbers, base 1024, this is the default
143 print human friendly numbers, base 1000
145 select the 1024 base for the following options, according to the IEC standard
147 select the 1000 base for the following options, according to the SI standard
149 show sizes in KiB, or kB with --si
151 show sizes in MiB, or MB with --si
153 show sizes in GiB, or GB with --si
155 show sizes in TiB, or TB with --si
157 show data in tabular format
159 If conflicting options are passed, the last one takes precedence.
163 *btrfs filesystem* returns a zero exit status if it succeeds. Non zero is
164 returned in case of failure.
168 *btrfs* is part of btrfs-progs.
169 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for