btrfs-progs: docs: fix typos
[platform/upstream/btrfs-progs.git] / Documentation / btrfs-filesystem.asciidoc
index 2612617..f0a9ba4 100644 (file)
@@ -3,7 +3,7 @@ btrfs-filesystem(8)
 
 NAME
 ----
-btrfs-filesystem - command group of btrfs that usually work on the whole filesystem
+btrfs-filesystem - command group that primarily does work on the whole filesystems
 
 SYNOPSIS
 --------
@@ -11,9 +11,10 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-*btrfs filesystem* is used to do the whole filesystem level tasks, including
-all the regular filesystem operations like resizing, space stats, label
-setting/getting, and defragmentation.
+*btrfs filesystem* is used to perform several whole filesystem level tasks,
+including all the regular filesystem operations like resizing, space stats,
+label setting/getting, and defragmentation. There are other whole filesystem
+tasks like scrub or balance that are grouped in separate commands.
 
 SUBCOMMAND
 ----------
@@ -39,7 +40,7 @@ GlobalReserve, single: total=512.00MiB, used=0.00B
 ------------------------------
 +
 --
-* 'Data', 'System' and 'Metadata' are separeate block group types.
+* 'Data', 'System' and 'Metadata' are separate block group types.
 'GlobalReserve' is an artificial and internal emergency space, see below.
 * 'single' -- the allocation profile, defined at mkfs time
 * 'total' -- sum of space reserved for
@@ -52,8 +53,9 @@ not total size of filesystem.
 when the filesystem is full. Its 'total' size is dynamic based on the
 filesystem size, usually not larger than 512MiB, 'used' may fluctuate.
 +
-The global block reserve is accounted within Metadata. In case the filesystem
-metadata are exhausted, 'GlobalReserve/total + Metadata/used = Metadata/total'.
+The GlobalReserve is a portion of Metadata. In case the filesystem metadata is
+exhausted, 'GlobalReserve/total + Metadata/used = Metadata/total'. Otherwise
+there appears to be some unused space of Metadata.
 +
 `Options`
 +
@@ -79,11 +81,11 @@ show sizes in TiB, or TB with --si
 If conflicting options are passed, the last one takes precedence.
 
 *defragment* [options] <file>|<dir> [<file>|<dir>...]::
-Defragment file data on a mounted filesytem.
+Defragment file data on a mounted filesystem. Requires kernel 2.6.33 and newer.
 +
 If '-r' is passed, files in dir will be defragmented recursively.
 The start position and the number of bytes to defragment can be specified by
-start and len using '-s' and '-l' options below.
+start and length using '-s' and '-l' options below.
 Extents bigger than value given by '-t' will be skipped, otherwise this value
 is used as a target extent size, but is only advisory and may not be reached
 if the free space is too fragmented.
@@ -92,10 +94,18 @@ You can also turn on compression in defragment operations.
 +
 WARNING: Defragmenting with Linux kernel versions < 3.9 or ≥ 3.14-rc2 as well as
 with Linux stable kernel versions ≥ 3.10.31, ≥ 3.12.12 or ≥ 3.13.4 will break up
-the ref-links of COW data (for example files copied with `cp --reflink`,
+the reflinks of COW data (for example files copied with `cp --reflink`,
 snapshots or de-duplicated data).
 This may cause considerable increase of space usage depending on the broken up
-ref-links.
+reflinks.
++
+NOTE: Directory arguments without '-r' do not defragment files recursively but will
+defragment certain internal trees (extent tree and the subvolume tree). This has been
+confusing and could be removed in the future.
++
+For 'start', 'len', 'size' it is possible to append
+units designator: \'K', \'M', \'G', \'T', \'P', or \'E', which represent
+KiB, MiB, GiB, TiB, PiB, or EiB, respectively (case does not matter).
 +
 `Options`
 +
@@ -103,34 +113,69 @@ ref-links.
 be verbose, print file names as they're submitted for defragmentation
 -c[<algo>]::::
 compress file contents while defragmenting. Optional argument selects the compression
-algorithm, 'zlib' (default) or 'lzo'. Currently it's not possible to select no
+algorithm, 'zlib' (default), 'lzo' or 'zstd'. Currently it's not possible to select no
 compression. See also section 'EXAMPLES'.
 -r::::
 defragment files recursively in given directories
 -f::::
-flush data for each file before going to the next file. This will limit the amount
-of dirty data to current file, otherwise the amount cumulates from several files
-and may increase system load.
+flush data for each file before going to the next file.
++
+This will limit the amount of dirty data to current file, otherwise the amount
+accumulates from several files and will increase system load. This can also lead
+to ENOSPC if there's too much dirty data to write and it's not possible to make
+the reservations for the new data (ie. how the COW design works).
++
 -s <start>[kKmMgGtTpPeE]::::
 defragmentation will start from the given offset, default is beginning of a file
 -l <len>[kKmMgGtTpPeE]::::
 defragment only up to 'len' bytes, default is the file size
 -t <size>[kKmMgGtTpPeE]::::
-target extent size, do not touch extents bigger than 'size'
+target extent size, do not touch extents bigger than 'size', default: 32M
 +
-For 'start', 'len', 'size' it is possible to append
-units designator: \'K', \'M', \'G', \'T', \'P', or \'E', which represent
-KiB, MiB, GiB, TiB, PiB, or EiB, respectively (case does not matter).
+The value is only advisory and the final size of the extents may differ,
+depending on the state of the free space and fragmentation or other internal
+logic. Reasonable values are from tens to hundreds of megabytes.
+
+*du* [options] <path> [<path>..]::
+Calculate disk usage of the target files using FIEMAP. For individual
+files, it will report a count of total bytes, and exclusive (not
+shared) bytes. We also calculate a 'set shared' value which is
+described below.
 +
-NOTE: Directory arguments without '-r' do not defragment files recursively but will
-defragment certain internal trees (extent tree and the subvolume tree). This has been
-confusing and could be removed in the future.
+Each argument to 'btrfs filesystem du' will have a 'set shared' value
+calculated for it. We define each 'set' as those files found by a
+recursive search of an argument. The 'set shared' value
+then is a sum of all shared space referenced by the set.
++
+'set shared' takes into account overlapping shared extents, hence it
+isn't as simple as adding up shared extents.
++
+`Options`
++
+-s|--summarize::::
+display only a total for each argument
+--raw::::
+raw numbers in bytes, without the 'B' suffix.
+--human-readable::::
+print human friendly numbers, base 1024, this is the default
+--iec::::
+select the 1024 base for the following options, according to the IEC standard.
+--si::::
+select the 1000 base for the following options, according to the SI standard.
+--kbytes::::
+show sizes in KiB, or kB with --si.
+--mbytes::::
+show sizes in MiB, or MB with --si.
+--gbytes::::
+show sizes in GiB, or GB with --si.
+--tbytes::::
+show sizes in TiB, or TB with --si.
 
-*label* [<dev>|<mountpoint>] [<newlabel>]::
+*label* [<device>|<mountpoint>] [<newlabel>]::
 Show or update the label of a filesystem. This works on a mounted filesystem or
 a filesystem image.
 +
-The 'newlabel' argument is optional. Current label is printed if the the argument
+The 'newlabel' argument is optional. Current label is printed if the argument
 is omitted.
 +
 NOTE: the maximum allowable length shall be less than 256 chars and must not contain
@@ -152,7 +197,7 @@ If the prefix '+' or '-' is present the size is increased or decreased
 by the quantity 'size'.
 If no units are specified, bytes are assumed for 'size'.
 Optionally, the size parameter may be suffixed by one of the following
-units designators: \'K', \'M', \'G', \'T', \'P', or \'E', which represent
+unit designators: \'K', \'M', \'G', \'T', \'P', or \'E', which represent
 KiB, MiB, GiB, TiB, PiB, or EiB, respectively (case does not matter).
 +
 If 'max' is passed, the filesystem will occupy all available space on the
@@ -177,7 +222,7 @@ Show the btrfs filesystem with some additional info about devices and space
 allocation.
 +
 If no option none of 'path'/'uuid'/'device'/'label' is passed, information
-about all the BTRFS filesystems is shown, both mounted and unmounted. 
+about all the BTRFS filesystems is shown, both mounted and unmounted.
 +
 `Options`
 +
@@ -218,7 +263,7 @@ root user (due to use of restricted ioctl). For both there's a summary section
 with information about space usage:
 +
 -------------------------
-$ btrfs fi usage /path
+$ btrfs filesystem usage /path
 WARNING: cannot read detailed chunk info, RAID5/6 numbers will be incorrect, run as root
 Overall:
     Device size:                   1.82TiB
@@ -286,18 +331,18 @@ of IO load and the system may stall for a moment.
 
 *$ btrfs filesystem defrag -v -r -f dir/*
 
-Recusively defragment files under 'dir/', be verbose and wait until all blocks
+Recursively defragment files under 'dir/', be verbose and wait until all blocks
 are flushed before processing next file. You can note slower progress of the
 output and lower IO load (proportional to currently defragmented file).
 
 *$ btrfs filesystem defrag -v -r -f -clzo dir/*
 
-Recusively defragment files under 'dir/', be verbose, wait until all blocks are
+Recursively defragment files under 'dir/', be verbose, wait until all blocks are
 flushed and force file compression.
 
 *$ btrfs filesystem defrag -v -r -t 64M dir/*
 
-Recusively defragment files under 'dir/', be verbose and try to merge extents
+Recursively defragment files under 'dir/', be verbose and try to merge extents
 to be about 64MiB. As stated above, the success rate depends on actual free
 space fragmentation and the final result is not guaranteed to meet the target
 even if run repeatedly.
@@ -315,9 +360,9 @@ specify the devid though.
 
 *$ btrfs filesystem resize 1:max /path*
 
-Let's assume that devid 1 exists, the filesystem does not occupy the whole block
-device, eg. it has been enlarged and we wan the grow the filesystem. Simply using
-'max' as size we will achieve that.
+Let's assume that devid 1 exists and the filesystem does not occupy the whole
+block device, eg. it has been enlarged and we want to grow the filesystem. By
+simply using 'max' as size we will achieve that.
 
 NOTE: There are two ways to minimize the filesystem on a given device. The
 *btrfs inspect-internal min-dev-size* command, or iteratively shrink in steps.