Debian Codegraph @

upstream/opensuse-leap-16-1/man8/btrfs-filesystem.8

raw
1 .\" Man page generated from reStructuredText.
2 .
3 .
4 .nr rst2man-indent-level 0
5 .
6 .de1 rstReportMargin
7 \\$1 \\n[an-margin]
8 level \\n[rst2man-indent-level]
9 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
10 -
11 \\n[rst2man-indent0]
12 \\n[rst2man-indent1]
13 \\n[rst2man-indent2]
14 ..
15 .de1 INDENT
16 .\" .rstReportMargin pre:
17 . RS \\$1
18 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
19 . nr rst2man-indent-level +1
20 .\" .rstReportMargin post:
21 ..
22 .de UNINDENT
23 . RE
24 .\" indent \\n[an-margin]
25 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
26 .nr rst2man-indent-level -1
27 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
28 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
29 ..
30 .TH "BTRFS-FILESYSTEM" "8" "Mar 26, 2025" "6.14" "BTRFS"
31 .SH NAME
32 btrfs-filesystem \- command group that primarily does work on the whole filesystems
33 .SH SYNOPSIS
34 .sp
35 \fBbtrfs filesystem\fP <subcommand> <args>
36 .SH DESCRIPTION
37 .sp
38 \fBbtrfs filesystem\fP is used to perform several whole filesystem level tasks,
39 including all the regular filesystem operations like resizing, space stats,
40 label setting/getting, and defragmentation. There are other whole filesystem
41 tasks like scrub or balance that are grouped in separate commands (\fI\%btrfs\-scrub(8)\fP, \fI\%btrfs\-balance(8)\fP).
42 .SH SUBCOMMAND
43 .INDENT 0.0
44 .TP
45 .B df [options] <path>
46 Show a terse summary information about allocation of block group types of a given
47 mount point. The original purpose of this command was a debugging helper. The
48 output needs to be further interpreted and is not suitable for quick overview.
49 .sp
50 An example with description:
51 .INDENT 7.0
52 .IP \(bu 2
53 device size: \fI1.9TiB\fP, one device, no RAID
54 .IP \(bu 2
55 filesystem size: \fI1.9TiB\fP
56 .IP \(bu 2
57 created with: \fBmkfs.btrfs \-d single \-m single\fP
58 .UNINDENT
59 .INDENT 7.0
60 .INDENT 3.5
61 .sp
62 .EX
63 $ btrfs filesystem df /path
64 Data, single: total=1.15TiB, used=1.13TiB
65 System, single: total=32.00MiB, used=144.00KiB
66 Metadata, single: total=12.00GiB, used=6.45GiB
67 GlobalReserve, single: total=512.00MiB, used=0.00B
68 .EE
69 .UNINDENT
70 .UNINDENT
71 .INDENT 7.0
72 .IP \(bu 2
73 \fIData\fP, \fISystem\fP and \fIMetadata\fP are separate block group types.
74 \fIGlobalReserve\fP is an artificial and internal emergency space, see
75 below.
76 .IP \(bu 2
77 \fIsingle\fP \-\- the allocation profile, defined at mkfs time
78 .IP \(bu 2
79 \fItotal\fP \-\- sum of space reserved for all allocation profiles of the
80 given type, i.e. all Data/single. Note that it\(aqs not total size of
81 filesystem.
82 .IP \(bu 2
83 \fIused\fP \-\- sum of used space of the above, i.e. file extents, metadata blocks
84 .UNINDENT
85 .sp
86 \fIGlobalReserve\fP is an artificial and internal emergency space. It is used e.g.
87 when the filesystem is full. Its \fItotal\fP size is dynamic based on the
88 filesystem size, usually not larger than 512MiB, \fIused\fP may fluctuate.
89 .sp
90 The GlobalReserve is a portion of Metadata. In case the filesystem metadata is
91 exhausted, \fIGlobalReserve/total + Metadata/used = Metadata/total\fP\&. Otherwise
92 there appears to be some unused space of Metadata.
93 .sp
94 \fBOptions\fP
95 .INDENT 7.0
96 .TP
97 .B \-b|\-\-raw
98 raw numbers in bytes, without the \fIB\fP suffix
99 .TP
100 .B \-h|\-\-human\-readable
101 print human friendly numbers, base 1024, this is the default
102 .UNINDENT
103 .INDENT 7.0
104 .TP
105 .B \-H
106 print human friendly numbers, base 1000
107 .TP
108 .B \-\-iec
109 select the 1024 base for the following options, according to the IEC standard
110 .TP
111 .B \-\-si
112 select the 1000 base for the following options, according to the SI standard
113 .UNINDENT
114 .INDENT 7.0
115 .TP
116 .B \-k|\-\-kbytes
117 show sizes in KiB, or kB with \-\-si
118 .TP
119 .B \-m|\-\-mbytes
120 show sizes in MiB, or MB with \-\-si
121 .TP
122 .B \-g|\-\-gbytes
123 show sizes in GiB, or GB with \-\-si
124 .TP
125 .B \-t|\-\-tbytes
126 show sizes in TiB, or TB with \-\-si
127 .UNINDENT
128 .sp
129 If conflicting options are passed, the last one takes precedence.
130 .UNINDENT
131 .INDENT 0.0
132 .TP
133 .B defragment [options] <file>|<dir> [<file>|<dir>...]
134 Defragment file data on a mounted filesystem. Requires kernel 2.6.33 and newer.
135 .sp
136 If \fI\-r\fP is passed, files in \fIdir\fP will be defragmented recursively (not
137 descending to subvolumes, mount points and directory symlinks).
138 The start position and the number of bytes to defragment can be specified by
139 start and length using \fI\-s\fP and \fI\-l\fP options below.
140 Extents bigger than value given by \fI\-t\fP will be skipped, otherwise this value
141 is used as a target extent size, but is only advisory and may not be reached
142 if the free space is too fragmented.
143 Use 0 to take the kernel default, which is 256KiB but may change in the future.
144 You can also turn on compression in defragment operations.
145 .sp
146 \fBWARNING:\fP
147 .INDENT 7.0
148 .INDENT 3.5
149 Defragmenting with Linux kernel versions < 3.9 or ≥ 3.14\-rc2 as well as
150 with Linux stable kernel versions ≥ 3.10.31, ≥ 3.12.12 or ≥ 3.13.4 will break up
151 the reflinks of COW data (for example files copied with \fBcp \-\-reflink\fP,
152 snapshots or de\-duplicated data).
153 This may cause considerable increase of space usage depending on the broken up
154 reflinks.
155 .UNINDENT
156 .UNINDENT
157 .sp
158 \fBNOTE:\fP
159 .INDENT 7.0
160 .INDENT 3.5
161 Directory arguments without \fI\-r\fP do not defragment files recursively but will
162 defragment certain internal trees (extent tree and the subvolume tree). This has been
163 confusing and could be removed in the future.
164 .UNINDENT
165 .UNINDENT
166 .sp
167 For \fIstart\fP, \fIlen\fP, \fIsize\fP it is possible to append
168 units designator: \fIK\fP, \fIM\fP, \fIG\fP, \fIT\fP, \fIP\fP, or \fIE\fP, which represent
169 KiB, MiB, GiB, TiB, PiB, or EiB, respectively (case does not matter).
170 .sp
171 \fBOptions\fP
172 .INDENT 7.0
173 .TP
174 .B \-c[<algo>]
175 compress file contents while defragmenting. Optional argument selects the compression
176 algorithm, \fIzlib\fP (default), \fIlzo\fP or \fIzstd\fP\&. Currently it\(aqs not possible to select no
177 compression. See also section \fIEXAMPLES\fP\&.
178 .TP
179 .B \-L|\-\-level <level>
180 Since kernel 6.14 the compresison can also take the level parameter which will be used
181 only for the defragmentation and overrides the eventual mount option compression level.
182 Valid levels depend on the compression algorithms: \fIzlib\fP
183 1..9, \fIlzo\fP does not have any levels, \fIzstd\fP the standard levels 1..15 and also the
184 realtime \-1..\-15.
185 .UNINDENT
186 .INDENT 7.0
187 .TP
188 .B \-r
189 defragment files recursively in given directories, does not descend to
190 subvolumes or mount points
191 .TP
192 .B \-f
193 flush data for each file before going to the next file.
194 .sp
195 This will limit the amount of dirty data to current file, otherwise the amount
196 accumulates from several files and will increase system load. This can also lead
197 to ENOSPC if there\(aqs too much dirty data to write and it\(aqs not possible to make
198 the reservations for the new data (i.e. how the COW design works).
199 .UNINDENT
200 .INDENT 7.0
201 .TP
202 .B \-s <start>[kKmMgGtTpPeE]
203 defragmentation will start from the given offset, default is beginning of a file
204 .TP
205 .B \-l <len>[kKmMgGtTpPeE]
206 defragment only up to \fIlen\fP bytes, default is the file size
207 .TP
208 .B \-t <size>[kKmMgGtTpPeE]
209 target extent size, do not touch extents bigger than \fIsize\fP, default: 32MiB
210 .sp
211 The value is only advisory and the final size of the extents may differ,
212 depending on the state of the free space and fragmentation or other internal
213 logic. Reasonable values are from tens to hundreds of megabytes.
214 .UNINDENT
215 .INDENT 7.0
216 .TP
217 .BI \-\-step \ SIZE
218 Perform defragmentation in the range in SIZE steps and flush (\fI\-f\fP) after each one.
219 The range is default (the whole file) or given by \fI\-s\fP and \fI\-l\fP, split into
220 the steps or done in one go if the step is larger. Minimum range size is 256KiB.
221 With verbosity options the progress of defragmentation will be also printed.
222 .TP
223 .B \-v
224 (deprecated) alias for global \fI\-v\fP option
225 .UNINDENT
226 .TP
227 .B du [options] <path> [<path>..]
228 Calculate disk usage of the target files using FIEMAP. For individual
229 files, it will report a count of total bytes, and exclusive (not
230 shared) bytes. We also calculate a \(aqset shared\(aq value which is
231 described below.
232 .sp
233 Each argument to \fBbtrfs filesystem du\fP will have a \fIset shared\fP value
234 calculated for it. We define each \fIset\fP as those files found by a
235 recursive search of an argument (recursion descends to subvolumes but not
236 mount points). The \fIset shared\fP value then is a sum of all shared space
237 referenced by the set.
238 .sp
239 \fIset shared\fP takes into account overlapping shared extents, hence it
240 isn\(aqt as simple as adding up shared extents.
241 .sp
242 \fBOptions\fP
243 .INDENT 7.0
244 .TP
245 .B \-s|\-\-summarize
246 display only a total for each argument
247 .UNINDENT
248 .INDENT 7.0
249 .TP
250 .B \-\-raw
251 raw numbers in bytes, without the \fIB\fP suffix.
252 .TP
253 .B \-\-human\-readable
254 print human friendly numbers, base 1024, this is the default
255 .TP
256 .B \-\-iec
257 select the 1024 base for the following options, according to the IEC standard.
258 .TP
259 .B \-\-si
260 select the 1000 base for the following options, according to the SI standard.
261 .TP
262 .B \-\-kbytes
263 show sizes in KiB, or kB with \-\-si.
264 .TP
265 .B \-\-mbytes
266 show sizes in MiB, or MB with \-\-si.
267 .TP
268 .B \-\-gbytes
269 show sizes in GiB, or GB with \-\-si.
270 .TP
271 .B \-\-tbytes
272 show sizes in TiB, or TB with \-\-si.
273 .UNINDENT
274 .UNINDENT
275 .INDENT 0.0
276 .TP
277 .B label [<device>|<mountpoint>] [<newlabel>]
278 Show or update the label of a filesystem. This works on a mounted filesystem or
279 a filesystem image.
280 .sp
281 The \fInewlabel\fP argument is optional. Current label is printed if the argument
282 is omitted.
283 .sp
284 \fBNOTE:\fP
285 .INDENT 7.0
286 .INDENT 3.5
287 The maximum allowable length shall be less than 256 chars and must not contain
288 a newline. The trailing newline is stripped automatically.
289 .UNINDENT
290 .UNINDENT
291 .TP
292 .B mkswapfile [\-s size] file
293 Create a new file that\(aqs suitable and formatted as a swapfile. Default
294 size is 2GiB, fixed page size 4KiB, minimum size is 40KiB.
295 .sp
296 A swapfile must be created in a specific way: NOCOW and preallocated.
297 Subvolume containing a swapfile cannot be snapshotted and blocks of an
298 activated swapfile cannot be balanced.
299 .sp
300 Swapfile creation can be achieved by standalone commands too. Activation
301 needs to be done by command \X'tty: link https://man7.org/linux/man-pages/man8/swapon.8.html'\fI\%swapon(8)\fP\X'tty: link'\&. See also command
302 \fBbtrfs inspect\-internal map\-swapfile\fP
303 and the \fI\%Swapfile feature\fP description.
304 .sp
305 \fBNOTE:\fP
306 .INDENT 7.0
307 .INDENT 3.5
308 The command is a simplified version of \(aqmkswap\(aq, if you want to set
309 label, page size, or other parameters please use \(aqmkswap\(aq proper.
310 .UNINDENT
311 .UNINDENT
312 .sp
313 \fBOptions\fP
314 .INDENT 7.0
315 .TP
316 .B \-s|\-\-size SIZE
317 Create swapfile of a given size SIZE (accepting k/m/g/e/p
318 suffix).
319 .TP
320 .B \-U|\-\-uuid UUID
321 specify UUID to use, or a special value: clear (all zeros), random,
322 time (time\-based random)
323 .UNINDENT
324 .UNINDENT
325 .INDENT 0.0
326 .TP
327 .B resize [options] [<devid>:][+/\-]<size>[kKmMgGtTpPeE]|[<devid>:]max <path>
328 Resize a mounted filesystem identified by \fIpath\fP\&. A particular device
329 can be resized by specifying a \fIdevid\fP\&.
330 .sp
331 \fBWARNING:\fP
332 .INDENT 7.0
333 .INDENT 3.5
334 If \fIpath\fP is a file containing a BTRFS image then resize does not work
335 as expected and does not resize the image. This would resize the underlying
336 filesystem instead.
337 .UNINDENT
338 .UNINDENT
339 .sp
340 The \fIdevid\fP can be found in the output of \fBbtrfs filesystem show\fP and
341 defaults to 1 if not specified.
342 The \fIsize\fP parameter specifies the new size of the filesystem.
343 If the prefix \fI+\fP or \fI\-\fP is present the size is increased or decreased
344 by the quantity \fIsize\fP\&.
345 If no units are specified, bytes are assumed for \fIsize\fP\&.
346 Optionally, the size parameter may be suffixed by one of the following
347 unit designators: \fIK\fP, \fIM\fP, \fIG\fP, \fIT\fP, \fIP\fP, or \fIE\fP, which represent
348 KiB, MiB, GiB, TiB, PiB, or EiB, respectively (case does not matter).
349 .sp
350 If \fImax\fP is passed, the filesystem will occupy all available space on the
351 device respecting \fIdevid\fP (remember, devid 1 by default).
352 .sp
353 The resize command does not manipulate the size of underlying
354 partition. If you wish to enlarge/reduce a filesystem, you must make sure you
355 expand the partition before enlarging the filesystem and shrink the
356 partition after reducing the size of the filesystem. This can be done using
357 \X'tty: link https://man7.org/linux/man-pages/man8/fdisk.8.html'\fI\%fdisk(8)\fP\X'tty: link' or \X'tty: link https://man7.org/linux/man-pages/man8/parted.8.html'\fI\%parted(8)\fP\X'tty: link' to delete the existing partition and recreate
358 it with the new desired size. When recreating the partition make sure to use
359 the same starting partition offset as before.
360 .sp
361 The size of the portion that the filesystem uses of an underlying device can be
362 determined via the \fBbtrfs filesystem show \-\-raw\fP command on the
363 filesystem’s mount point (where it’s given for each \fIdevid\fP after the string
364 \fIsize\fP or via the \fBbtrfs inspect\-internal dump\-super\fP command on the
365 specific device (where it’s given as the value of \fIdev_item.total_bytes\fP, which
366 is not to be confused with \fItotal_bytes\fP).
367 The value is also the address of the first byte not used by the
368 filesystem.
369 .sp
370 Growing is usually instant as it only updates the size. However, shrinking could
371 take a long time if there are data in the device area that\(aqs beyond the new
372 end. Relocation of the data takes time.
373 .sp
374 Note that there\(aqs a lower limit on the new size (either specified
375 as an absolute size or difference) that is checked by kernel and
376 rejected eventually as invalid. Lower values will print a warning but
377 still pass the request to kernel. The currently known value is 256MiB.
378 .sp
379 See also section \fIEXAMPLES\fP\&.
380 .sp
381 \fBOptions\fP
382 .INDENT 7.0
383 .TP
384 .B \-\-enqueue
385 wait if there\(aqs another exclusive operation running, otherwise continue
386 .UNINDENT
387 .TP
388 .B show [options] [<path>|<uuid>|<device>|<label>]
389 Show the btrfs filesystem with some additional info about devices and space
390 allocation.
391 .sp
392 If no option none of \fIpath\fP/\fIuuid\fP/\fIdevice\fP/\fIlabel\fP is passed, information
393 about all the BTRFS filesystems is shown, both mounted and unmounted.
394 .sp
395 \fBOptions\fP
396 .INDENT 7.0
397 .TP
398 .B \-m|\-\-mounted
399 probe kernel for mounted BTRFS filesystems
400 .TP
401 .B \-d|\-\-all\-devices
402 scan all devices under \fB/dev\fP, otherwise the devices list is extracted from the
403 \fB/proc/partitions\fP file. This is a fallback option if there\(aqs no device node
404 manager (like udev) available in the system.
405 .UNINDENT
406 .INDENT 7.0
407 .TP
408 .B \-\-raw
409 raw numbers in bytes, without the \fIB\fP suffix
410 .TP
411 .B \-\-human\-readable
412 print human friendly numbers, base 1024, this is the default
413 .TP
414 .B \-\-iec
415 select the 1024 base for the following options, according to the IEC standard
416 .TP
417 .B \-\-si
418 select the 1000 base for the following options, according to the SI standard
419 .TP
420 .B \-\-kbytes
421 show sizes in KiB, or kB with \-\-si
422 .TP
423 .B \-\-mbytes
424 show sizes in MiB, or MB with \-\-si
425 .TP
426 .B \-\-gbytes
427 show sizes in GiB, or GB with \-\-si
428 .TP
429 .B \-\-tbytes
430 show sizes in TiB, or TB with \-\-si
431 .UNINDENT
432 .TP
433 .B sync <path>
434 Force a sync of the filesystem at \fIpath\fP, similar to the \X'tty: link https://man7.org/linux/man-pages/man1/sync.1.html'\fI\%sync(1)\fP\X'tty: link' command. In
435 addition, it starts cleaning of deleted subvolumes. To wait for the subvolume
436 deletion to complete use the \fBbtrfs subvolume sync\fP command.
437 .TP
438 .B usage [options] <path> [<path>...]
439 Show detailed information about internal filesystem usage. This is supposed to
440 replace the \fBbtrfs filesystem df\fP command in the long run.
441 .sp
442 The level of detail can differ if the command is run under a regular or the
443 root user (due to use of restricted ioctl). For both there\(aqs a summary section
444 with information about space usage:
445 .INDENT 7.0
446 .INDENT 3.5
447 .sp
448 .EX
449 $ btrfs filesystem usage /path
450 WARNING: cannot read detailed chunk info, RAID5/6 numbers will be incorrect, run as root
451 Overall:
452 Device size: 1.82TiB
453 Device allocated: 1.17TiB
454 Device unallocated: 669.99GiB
455 Device missing: 0.00B
456 Device slack: 1.00GiB
457 Used: 1.14TiB
458 Free (estimated): 692.57GiB (min: 692.57GiB)
459 Free (statfs, df) 692.57GiB
460 Data ratio: 1.00
461 Metadata ratio: 1.00
462 Global reserve: 512.00MiB (used: 0.00B)
463 Multiple profiles: no
464 .EE
465 .UNINDENT
466 .UNINDENT
467 .INDENT 7.0
468 .IP \(bu 2
469 \fIDevice size\fP \-\- sum of raw device capacity available to the
470 filesystem, note that this may not be the same as the total device
471 size (the difference is accounted as slack)
472 .IP \(bu 2
473 \fIDevice allocated\fP \-\- sum of total space allocated for
474 data/metadata/system profiles, this also accounts space reserved but
475 not yet used for extents
476 .IP \(bu 2
477 \fIDevice unallocated\fP \-\- the remaining unallocated space for future
478 allocations (difference of the above two numbers)
479 .IP \(bu 2
480 \fIDevice missing\fP \-\- sum of capacity of all missing devices
481 .IP \(bu 2
482 \fIDevice slack\fP \-\- sum of slack space on all devices (difference
483 between entire device size and the space occupied by filesystem)
484 .IP \(bu 2
485 \fIUsed\fP \-\- sum of the used space of data/metadata/system profiles, not
486 including the reserved space
487 .IP \(bu 2
488 \fIFree (estimated)\fP \-\- approximate size of the remaining free space
489 usable for data, including currently allocated space and estimating
490 the usage of the unallocated space based on the block group profiles,
491 the \fImin\fP is the lower bound of the estimate in case multiple
492 profiles are present
493 .IP \(bu 2
494 \fIFree (statfs, df)\fP \-\- the amount of space available for data as
495 reported by the \fBstatfs/statvfs\fP syscall, also returned as \fIAvail\fP in the
496 output of \fBdf\fP\&. The value is calculated in a different way and may
497 not match the estimate in some cases (e.g. multiple profiles).
498 .IP \(bu 2
499 \fIData ratio\fP \-\- ratio of total space for data including redundancy or
500 parity to the effectively usable data space, e.g. single is 1.0, RAID1
501 is 2.0 and for RAID5/6 it depends on the number of devices
502 .IP \(bu 2
503 \fIMetadata ratio\fP \-\- ditto, for metadata
504 .IP \(bu 2
505 \fIGlobal reserve\fP \-\- portion of metadata currently used for global
506 block reserve, used for emergency purposes (like deletion on a full
507 filesystem)
508 .IP \(bu 2
509 \fIMultiple profiles\fP \-\- what block group types (data, metadata) have
510 more than one profile (single, raid1, ...), see \fI\%btrfs(5)\fP section
511 \fI\%FILESYSTEMS WITH MULTIPLE PROFILES\fP\&.
512 .UNINDENT
513 .sp
514 And on a zoned filesystem there are two more lines in the \fIDevice\fP section:
515 .INDENT 7.0
516 .INDENT 3.5
517 .sp
518 .EX
519 Device zone unusable: 5.13GiB
520 Device zone size: 256.00MiB
521 .EE
522 .UNINDENT
523 .UNINDENT
524 .INDENT 7.0
525 .IP \(bu 2
526 \fIDevice zone unusable\fP \-\- sum of of space that\(aqs been used in the
527 past but now is not due to COW and not referenced anymore, the chunks
528 have to be reclaimed and zones reset to make it usable again
529 .IP \(bu 2
530 \fIDevice zone size\fP \-\- the reported zone size of the host\-managed
531 device, same for all devices
532 .UNINDENT
533 .sp
534 The root user will also see stats broken down by block group types:
535 .INDENT 7.0
536 .INDENT 3.5
537 .sp
538 .EX
539 Data,single: Size:1.15TiB, Used:1.13TiB (98.26%)
540 /dev/sdb 1.15TiB
541
542 Metadata,single: Size:12.00GiB, Used:6.45GiB (53.75%)
543 /dev/sdb 12.00GiB
544
545 System,single: Size:32.00MiB, Used:144.00KiB (0.44%)
546 /dev/sdb 32.00MiB
547
548 Unallocated:
549 /dev/sdb 669.99GiB
550 .EE
551 .UNINDENT
552 .UNINDENT
553 .sp
554 \fIData\fP is block group type, \fIsingle\fP is block group profile, \fISize\fP is total
555 size occupied by this type, \fIUsed\fP is the actually used space, the percent is
556 ratio of \fIUsed/Size\fP\&. The \fIUnallocated\fP is remaining space.
557 .sp
558 \fBOptions\fP
559 .INDENT 7.0
560 .TP
561 .B \-b|\-\-raw
562 raw numbers in bytes, without the \fIB\fP suffix
563 .TP
564 .B \-h|\-\-human\-readable
565 print human friendly numbers, base 1024, this is the default
566 .UNINDENT
567 .INDENT 7.0
568 .TP
569 .B \-H
570 print human friendly numbers, base 1000
571 .TP
572 .B \-\-iec
573 select the 1024 base for the following options, according to the IEC standard
574 .TP
575 .B \-\-si
576 select the 1000 base for the following options, according to the SI standard
577 .UNINDENT
578 .INDENT 7.0
579 .TP
580 .B \-k|\-\-kbytes
581 show sizes in KiB, or kB with \-\-si
582 .TP
583 .B \-m|\-\-mbytes
584 show sizes in MiB, or MB with \-\-si
585 .TP
586 .B \-g|\-\-gbytes
587 show sizes in GiB, or GB with \-\-si
588 .TP
589 .B \-t|\-\-tbytes
590 show sizes in TiB, or TB with \-\-si
591 .UNINDENT
592 .INDENT 7.0
593 .TP
594 .B \-T
595 show data in tabular format
596 .UNINDENT
597 .sp
598 If conflicting options are passed, the last one takes precedence.
599 .UNINDENT
600 .SH EXAMPLES
601 .sp
602 \fB$ btrfs filesystem defrag \-v \-r dir/\fP
603 .sp
604 Recursively defragment files under \fBdir/\fP, print files as they are processed.
605 The file names will be printed in batches, similarly the amount of data triggered
606 by defragmentation will be proportional to last N printed files. The system dirty
607 memory throttling will slow down the defragmentation but there can still be a lot
608 of IO load and the system may stall for a moment.
609 .sp
610 \fB$ btrfs filesystem defrag \-v \-r \-f dir/\fP
611 .sp
612 Recursively defragment files under \fBdir/\fP, be verbose and wait until all blocks
613 are flushed before processing next file. You can note slower progress of the
614 output and lower IO load (proportional to currently defragmented file).
615 .sp
616 \fB$ btrfs filesystem defrag \-v \-r \-f \-clzo dir/\fP
617 .sp
618 Recursively defragment files under \fBdir/\fP, be verbose, wait until all blocks are
619 flushed and force file compression.
620 .sp
621 \fB$ btrfs filesystem defrag \-v \-r \-t 64M dir/\fP
622 .sp
623 Recursively defragment files under \fBdir/\fP, be verbose and try to merge extents
624 to be about 64MiB. As stated above, the success rate depends on actual free
625 space fragmentation and the final result is not guaranteed to meet the target
626 even if run repeatedly.
627 .sp
628 \fB$ btrfs filesystem resize \-1G /path\fP
629 .sp
630 \fB$ btrfs filesystem resize 1:\-1G /path\fP
631 .sp
632 Shrink size of the filesystem\(aqs device id 1 by 1GiB. The first syntax expects a
633 device with id 1 to exist, otherwise fails. The second is equivalent and more
634 explicit. For a single\-device filesystem it\(aqs typically not necessary to
635 specify the devid though.
636 .sp
637 \fB$ btrfs filesystem resize max /path\fP
638 .sp
639 \fB$ btrfs filesystem resize 1:max /path\fP
640 .sp
641 Let\(aqs assume that devid 1 exists and the filesystem does not occupy the whole
642 block device, e.g. it has been enlarged and we want to grow the filesystem. By
643 simply using \fImax\fP as size we will achieve that.
644 .sp
645 \fBNOTE:\fP
646 .INDENT 0.0
647 .INDENT 3.5
648 There are two ways to minimize the filesystem on a given device. The
649 \fBbtrfs inspect\-internal min\-dev\-size\fP command, or iteratively shrink in steps.
650 .UNINDENT
651 .UNINDENT
652 .SH EXIT STATUS
653 .sp
654 \fBbtrfs filesystem\fP returns a zero exit status if it succeeds. Non zero is
655 returned in case of failure.
656 .SH AVAILABILITY
657 .sp
658 \fBbtrfs\fP is part of btrfs\-progs. Please refer to the documentation at
659 \X'tty: link https://btrfs.readthedocs.io'\fI\%https://btrfs.readthedocs.io\fP\X'tty: link'\&.
660 .SH SEE ALSO
661 .sp
662 \fI\%btrfs\-subvolume(8)\fP,
663 \fI\%mkfs.btrfs(8)\fP
664 .\" Generated by docutils manpage writer.
665 .