|
|
Line 1: |
Line 1: |
− | =btrfs-filesystem(8) manual page=
| |
| {{GeneratedManpage | | {{GeneratedManpage |
| |name=btrfs-filesystem}} | | |name=btrfs-filesystem}} |
− |
| |
− | ==NAME==
| |
− | btrfs-filesystem - command group that primarily does work on the whole filesystems
| |
− |
| |
− | ==SYNOPSIS==
| |
− |
| |
− | <p><b>btrfs filesystem</b> <em><subcommand></em> <em><args></em></p>
| |
− | ==DESCRIPTION==
| |
− |
| |
− | <p><b>btrfs filesystem</b> 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.</p>
| |
− | ==SUBCOMMAND==
| |
− |
| |
− | <dl>
| |
− | <dt>
| |
− | <b>df</b> [options] <em><path></em>
| |
− | <dd>
| |
− | <p>
| |
− | Show a terse summary information about allocation of block group types of a given
| |
− | mount point. The original purpose of this command was a debugging helper. The
| |
− | output needs to be further interpreted and is not suitable for quick overview.
| |
− | </p>
| |
− | <div>
| |
− | <p>An example with description:</p>
| |
− | <ul>
| |
− | <li>
| |
− | <p>
| |
− | device size: <em>1.9TiB</em>, one device, no RAID
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | filesystem size: <em>1.9TiB</em>
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | created with: <em>mkfs.btrfs -d single -m single</em>
| |
− | </p>
| |
− | </li>
| |
− | </ul>
| |
− | </div>
| |
− | <pre>$ btrfs filesystem df /path
| |
− | Data, single: total=1.15TiB, used=1.13TiB
| |
− | System, single: total=32.00MiB, used=144.00KiB
| |
− | Metadata, single: total=12.00GiB, used=6.45GiB
| |
− | GlobalReserve, single: total=512.00MiB, used=0.00B</pre>
| |
− | <div>
| |
− | <ul>
| |
− | <li>
| |
− | <p>
| |
− | <em>Data</em>, <em>System</em> and <em>Metadata</em> are separate block group types.
| |
− | <em>GlobalReserve</em> is an artificial and internal emergency space, see below.
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>single</em> — the allocation profile, defined at mkfs time
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>total</em> — sum of space reserved for
| |
− | all allocation profiles of the given type, ie. all Data/single. Note that it’s
| |
− | not total size of filesystem.
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>used</em> — sum of used space of the above, ie. file extents, metadata blocks
| |
− | </p>
| |
− | </li>
| |
− | </ul>
| |
− | </div>
| |
− | <p><em>GlobalReserve</em> is an artificial and internal emergency space. It is used eg.
| |
− | when the filesystem is full. Its <em>total</em> size is dynamic based on the
| |
− | filesystem size, usually not larger than 512MiB, <em>used</em> may fluctuate.</p>
| |
− | <p>The GlobalReserve is a portion of Metadata. In case the filesystem metadata is
| |
− | exhausted, <em>GlobalReserve/total + Metadata/used = Metadata/total</em>. Otherwise
| |
− | there appears to be some unused space of Metadata.</p>
| |
− | <p><tt>Options</tt></p>
| |
− | <dl>
| |
− | <dt>
| |
− | -b|--raw
| |
− | <dd>
| |
− | <p>
| |
− | raw numbers in bytes, without the <em>B</em> suffix
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -h|--human-readable
| |
− | <dd>
| |
− | <p>
| |
− | print human friendly numbers, base 1024, this is the default
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -H
| |
− | <dd>
| |
− | <p>
| |
− | print human friendly numbers, base 1000
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --iec
| |
− | <dd>
| |
− | <p>
| |
− | select the 1024 base for the following options, according to the IEC standard
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --si
| |
− | <dd>
| |
− | <p>
| |
− | select the 1000 base for the following options, according to the SI standard
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -k|--kbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in KiB, or kB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -m|--mbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in MiB, or MB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -g|--gbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in GiB, or GB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -t|--tbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in TiB, or TB with --si
| |
− | </p>
| |
− | <p>If conflicting options are passed, the last one takes precedence.</p>
| |
− |
| |
− | </dl>
| |
− |
| |
− | <dt>
| |
− | <b>defragment</b> [options] <em><file></em>|<em><dir></em> [<em><file></em>|<em><dir></em>…]
| |
− | <dd>
| |
− | <p>
| |
− | Defragment file data on a mounted filesystem. Requires kernel 2.6.33 and newer.
| |
− | </p>
| |
− | <p>If <em>-r</em> is passed, files in dir will be defragmented recursively (not
| |
− | descending to subvolumes, mount points and directory symlinks).
| |
− | The start position and the number of bytes to defragment can be specified by
| |
− | start and length using <em>-s</em> and <em>-l</em> options below.
| |
− | Extents bigger than value given by <em>-t</em> 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.
| |
− | Use 0 to take the kernel default, which is 256kB but may change in the future.
| |
− | You can also turn on compression in defragment operations.</p>
| |
− | <blockquote><b>Warning:</b>
| |
− | 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 reflinks of COW data (for example files copied with <tt>cp --reflink</tt>,
| |
− | snapshots or de-duplicated data).
| |
− | This may cause considerable increase of space usage depending on the broken up
| |
− | reflinks.</blockquote>
| |
− | <blockquote><b>Note:</b>
| |
− | Directory arguments without <em>-r</em> 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.</blockquote>
| |
− | <p>For <em>start</em>, <em>len</em>, <em>size</em> 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).</p>
| |
− | <p><tt>Options</tt></p>
| |
− | <dl>
| |
− | <dt>
| |
− | -c[<em><algo></em>]
| |
− | <dd>
| |
− | <p>
| |
− | compress file contents while defragmenting. Optional argument selects the compression
| |
− | algorithm, <em>zlib</em> (default), <em>lzo</em> or <em>zstd</em>. Currently it’s not possible to select no
| |
− | compression. See also section <em>EXAMPLES</em>.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -r
| |
− | <dd>
| |
− | <p>
| |
− | defragment files recursively in given directories, does not descend to
| |
− | subvolumes or mount points
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -f
| |
− | <dd>
| |
− | <p>
| |
− | flush data for each file before going to the next file.
| |
− | </p>
| |
− | <p>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).</p>
| |
− |
| |
− | <dt>
| |
− | -s <em><start></em>[kKmMgGtTpPeE]
| |
− | <dd>
| |
− | <p>
| |
− | defragmentation will start from the given offset, default is beginning of a file
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -l <em><len></em>[kKmMgGtTpPeE]
| |
− | <dd>
| |
− | <p>
| |
− | defragment only up to <em>len</em> bytes, default is the file size
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -t <em><size></em>[kKmMgGtTpPeE]
| |
− | <dd>
| |
− | <p>
| |
− | target extent size, do not touch extents bigger than <em>size</em>, default: 32M
| |
− | </p>
| |
− | <p>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.</p>
| |
− |
| |
− | <dt>
| |
− | -v
| |
− | <dd>
| |
− | <p>
| |
− | (deprecated) alias for global <em>-v</em> option
| |
− | </p>
| |
− |
| |
− | </dl>
| |
− |
| |
− | <dt>
| |
− | <b>du</b> [options] <em><path></em> [<em><path></em>..]
| |
− | <dd>
| |
− | <p>
| |
− | 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 <em>set shared</em> value which is
| |
− | described below.
| |
− | </p>
| |
− | <p>Each argument to <em>btrfs filesystem du</em> will have a <em>set shared</em> value
| |
− | calculated for it. We define each <em>set</em> as those files found by a
| |
− | recursive search of an argument (recursion descends to subvolumes but not
| |
− | mount points). The <em>set shared</em> value then is a sum of all shared space
| |
− | referenced by the set.</p>
| |
− | <p><em>set shared</em> takes into account overlapping shared extents, hence it
| |
− | isn’t as simple as adding up shared extents.</p>
| |
− | <p><tt>Options</tt></p>
| |
− | <dl>
| |
− | <dt>
| |
− | -s|--summarize
| |
− | <dd>
| |
− | <p>
| |
− | display only a total for each argument
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --raw
| |
− | <dd>
| |
− | <p>
| |
− | raw numbers in bytes, without the <em>B</em> suffix.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --human-readable
| |
− | <dd>
| |
− | <p>
| |
− | print human friendly numbers, base 1024, this is the default
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --iec
| |
− | <dd>
| |
− | <p>
| |
− | select the 1024 base for the following options, according to the IEC standard.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --si
| |
− | <dd>
| |
− | <p>
| |
− | select the 1000 base for the following options, according to the SI standard.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --kbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in KiB, or kB with --si.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --mbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in MiB, or MB with --si.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --gbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in GiB, or GB with --si.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --tbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in TiB, or TB with --si.
| |
− | </p>
| |
− |
| |
− | </dl>
| |
− |
| |
− | <dt>
| |
− | <b>label</b> [<em><device></em>|<em><mountpoint></em>] [<em><newlabel></em>]
| |
− | <dd>
| |
− | <p>
| |
− | Show or update the label of a filesystem. This works on a mounted filesystem or
| |
− | a filesystem image.
| |
− | </p>
| |
− | <p>The <em>newlabel</em> argument is optional. Current label is printed if the argument
| |
− | is omitted.</p>
| |
− | <blockquote><b>Note:</b>
| |
− | the maximum allowable length shall be less than 256 chars and must not contain
| |
− | a newline. The trailing newline is stripped automatically.</blockquote>
| |
− |
| |
− | </dl>
| |
− | <dl>
| |
− | <dt>
| |
− | <b>resize</b> [options] [<em><devid></em>:][+/-]<em><size></em>[kKmMgGtTpPeE]|[<em><devid></em>:]max <em><path></em>
| |
− | <dd>
| |
− | <p>
| |
− | Resize a mounted filesystem identified by <em>path</em>. A particular device
| |
− | can be resized by specifying a <em>devid</em>.
| |
− | </p>
| |
− | <blockquote><b>Warning:</b>
| |
− | If <em>path</em> is a file containing a BTRFS image then resize does not work
| |
− | as expected and does not resize the image. This would resize the underlying
| |
− | filesystem instead.</blockquote>
| |
− | <p>The <em>devid</em> can be found in the output of <b>btrfs filesystem show</b> and
| |
− | defaults to 1 if not specified.
| |
− | The <em>size</em> parameter specifies the new size of the filesystem.
| |
− | If the prefix <em>+</em> or <em>-</em> is present the size is increased or decreased
| |
− | by the quantity <em>size</em>.
| |
− | If no units are specified, bytes are assumed for <em>size</em>.
| |
− | Optionally, the size parameter may be suffixed by one of the following
| |
− | unit designators: 'K', 'M', 'G', 'T', 'P', or 'E', which represent
| |
− | KiB, MiB, GiB, TiB, PiB, or EiB, respectively (case does not matter).</p>
| |
− | <p>If <em>max</em> is passed, the filesystem will occupy all available space on the
| |
− | device respecting <em>devid</em> (remember, devid 1 by default).</p>
| |
− | <p>The resize command does not manipulate the size of underlying
| |
− | partition. If you wish to enlarge/reduce a filesystem, you must make sure you
| |
− | can expand the partition before enlarging the filesystem and shrink the
| |
− | partition after reducing the size of the filesystem. This can done using
| |
− | [http://man7.org/linux/man-pages/man8/fdisk.8.html fdisk(8)] or [http://man7.org/linux/man-pages/man8/parted.8.html parted(8)] to delete the existing partition and recreate
| |
− | it with the new desired size. When recreating the partition make sure to use
| |
− | the same starting partition offset as before.</p>
| |
− | <p>Growing is usually instant as it only updates the size. However, shrinking could
| |
− | take a long time if there are data in the device area that’s beyond the new
| |
− | end. Relocation of the data takes time.</p>
| |
− | <p>See also section <em>EXAMPLES</em>.</p>
| |
− | <p><tt>Options</tt></p>
| |
− | <dl>
| |
− | <dt>
| |
− | --enqueue
| |
− | <dd>
| |
− | <p>
| |
− | wait if there’s another exclusive operation running, otherwise continue
| |
− | </p>
| |
− |
| |
− | </dl>
| |
− |
| |
− | <dt>
| |
− | <b>show</b> [options] [<em><path></em>|<em><uuid></em>|<em><device></em>|<em><label></em>]
| |
− | <dd>
| |
− | <p>
| |
− | Show the btrfs filesystem with some additional info about devices and space
| |
− | allocation.
| |
− | </p>
| |
− | <p>If no option none of <em>path</em>/<em>uuid</em>/<em>device</em>/<em>label</em> is passed, information
| |
− | about all the BTRFS filesystems is shown, both mounted and unmounted.</p>
| |
− | <p><tt>Options</tt></p>
| |
− | <dl>
| |
− | <dt>
| |
− | -m|--mounted
| |
− | <dd>
| |
− | <p>
| |
− | probe kernel for mounted BTRFS filesystems
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -d|--all-devices
| |
− | <dd>
| |
− | <p>
| |
− | scan all devices under /dev, otherwise the devices list is extracted from the
| |
− | /proc/partitions file. This is a fallback option if there’s no device node
| |
− | manager (like udev) available in the system.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --raw
| |
− | <dd>
| |
− | <p>
| |
− | raw numbers in bytes, without the <em>B</em> suffix
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --human-readable
| |
− | <dd>
| |
− | <p>
| |
− | print human friendly numbers, base 1024, this is the default
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --iec
| |
− | <dd>
| |
− | <p>
| |
− | select the 1024 base for the following options, according to the IEC standard
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --si
| |
− | <dd>
| |
− | <p>
| |
− | select the 1000 base for the following options, according to the SI standard
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --kbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in KiB, or kB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --mbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in MiB, or MB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --gbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in GiB, or GB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --tbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in TiB, or TB with --si
| |
− | </p>
| |
− |
| |
− | </dl>
| |
− |
| |
− | <dt>
| |
− | <b>sync</b> <em><path></em>
| |
− | <dd>
| |
− | <p>
| |
− | Force a sync of the filesystem at <em>path</em>, similar to the [http://man7.org/linux/man-pages/man1/sync.1.html sync(1)] command. In
| |
− | addition, it starts cleaning of deleted subvolumes. To wait for the subvolume
| |
− | deletion to complete use the <b>btrfs subvolume sync</b> command.
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | <b>usage</b> [options] <em><path></em> [<em><path></em>…]
| |
− | <dd>
| |
− | <p>
| |
− | Show detailed information about internal filesystem usage. This is supposed to
| |
− | replace the <b>btrfs filesystem df</b> command in the long run.
| |
− | </p>
| |
− | <p>The level of detail can differ if the command is run under a regular or the
| |
− | root user (due to use of restricted ioctl). For both there’s a summary section
| |
− | with information about space usage:</p>
| |
− | <pre>$ btrfs filesystem usage /path
| |
− | WARNING: cannot read detailed chunk info, RAID5/6 numbers will be incorrect, run as root
| |
− | Overall:
| |
− | Device size: 1.82TiB
| |
− | Device allocated: 1.17TiB
| |
− | Device unallocated: 669.99GiB
| |
− | Device missing: 0.00B
| |
− | Used: 1.14TiB
| |
− | Free (estimated): 692.57GiB (min: 692.57GiB)
| |
− | Free (statfs, df) 692.57GiB
| |
− | Data ratio: 1.00
| |
− | Metadata ratio: 1.00
| |
− | Global reserve: 512.00MiB (used: 0.00B)
| |
− | Multiple profiles: no</pre>
| |
− | <div>
| |
− | <ul>
| |
− | <li>
| |
− | <p>
| |
− | <em>Device size</em> — sum of raw device capacity available to the filesystem
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Device allocated</em> — sum of total space allocated for data/metadata/system
| |
− | profiles, this also accounts space reserved but not yet used for extents
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Device unallocated</em> — the remaining unallocated space for future
| |
− | allocations (difference of the above two numbers)
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Device missing</em> — sum of capacity of all missing devices
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Used</em> — sum of the used space of data/metadata/system profiles, not
| |
− | including the reserved space
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Free (estimated)</em> — approximate size of the remaining free space usable for
| |
− | data, including currently allocated space and estimating the usage of the
| |
− | unallocated space based on the block group profiles, the <em>min</em> is the lower bound
| |
− | of the estimate in case multiple profiles are present
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Free (statfs, df)</em> — the amount of space available for data as reported by the
| |
− | <tt>statfs</tt> syscall, also returned as <em>Avail</em> in the output of <em>df</em>. The value is
| |
− | calculated in a different way and may not match the estimate in some cases (eg.
| |
− | multiple profiles).
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Data ratio</em> — ratio of total space for data including redundancy or parity to
| |
− | the effectively usable data space, eg. single is 1.0, RAID1 is 2.0 and for RAID5/6
| |
− | it depends on the number of devices
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Metadata ratio</em> — dtto, for metadata
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Global reserve</em> — portion of metadata currently used for global block
| |
− | reserve, used for emergency purposes (like deletion on a full filesystem)
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Multiple profiles</em> — what block group types (data, metadata) have more than
| |
− | one profile (single, raid1, …), see [[Manpage/btrfs|btrfs(5)]]
| |
− | section <em>FILESYSTEMS WITH MULTIPLE BLOCK GROUP PROFILES</em>.
| |
− | </p>
| |
− | </li>
| |
− | </ul>
| |
− | </div>
| |
− | <p>And on a zoned filesystem there are two more lines in the <em>Device</em> section:</p>
| |
− | <pre> Device zone unusable: 5.13GiB
| |
− | Device zone size: 256.00MiB</pre>
| |
− | <div>
| |
− | <ul>
| |
− | <li>
| |
− | <p>
| |
− | <em>Device zone unusable</em> — sum of of space that’s been used in the past
| |
− | but now is not due to COW and not referenced anymory, the chunks have to
| |
− | be reclaimed and zones reset to make it usable again
| |
− | </p>
| |
− | </li>
| |
− | <li>
| |
− | <p>
| |
− | <em>Device zone size</em> — the reported zone size of the host-managed device, same
| |
− | for all devices
| |
− | </p>
| |
− | </li>
| |
− | </ul>
| |
− | </div>
| |
− | <p>The root user will also see stats broken down by block group types:</p>
| |
− | <pre>Data,single: Size:1.15TiB, Used:1.13TiB (98.26%)
| |
− | /dev/sdb 1.15TiB
| |
− |
| |
− | Metadata,single: Size:12.00GiB, Used:6.45GiB (53.75%)
| |
− | /dev/sdb 12.00GiB
| |
− |
| |
− | System,single: Size:32.00MiB, Used:144.00KiB (0.44%)
| |
− | /dev/sdb 32.00MiB
| |
− |
| |
− | Unallocated:
| |
− | /dev/sdb 669.99GiB</pre>
| |
− | <p><em>Data</em> is block group type, <em>single</em> is block group profile, <em>Size</em> is total
| |
− | size occupied by this type, <em>Used</em> is the actually used space, the percent is
| |
− | ratio of <em>Used/Size</em>. The <em>Unallocated</em> is remaining space.</p>
| |
− | <p><tt>Options</tt></p>
| |
− | <dl>
| |
− | <dt>
| |
− | -b|--raw
| |
− | <dd>
| |
− | <p>
| |
− | raw numbers in bytes, without the <em>B</em> suffix
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -h|--human-readable
| |
− | <dd>
| |
− | <p>
| |
− | print human friendly numbers, base 1024, this is the default
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -H
| |
− | <dd>
| |
− | <p>
| |
− | print human friendly numbers, base 1000
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --iec
| |
− | <dd>
| |
− | <p>
| |
− | select the 1024 base for the following options, according to the IEC standard
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | --si
| |
− | <dd>
| |
− | <p>
| |
− | select the 1000 base for the following options, according to the SI standard
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -k|--kbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in KiB, or kB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -m|--mbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in MiB, or MB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -g|--gbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in GiB, or GB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -t|--tbytes
| |
− | <dd>
| |
− | <p>
| |
− | show sizes in TiB, or TB with --si
| |
− | </p>
| |
− |
| |
− | <dt>
| |
− | -T
| |
− | <dd>
| |
− | <p>
| |
− | show data in tabular format
| |
− | </p>
| |
− | <p>If conflicting options are passed, the last one takes precedence.</p>
| |
− |
| |
− | </dl>
| |
− |
| |
− | </dl>
| |
− | ==EXAMPLES==
| |
− |
| |
− | <p><b>$ btrfs filesystem defrag -v -r dir/</b></p>
| |
− | <p>Recursively defragment files under <em>dir/</em>, print files as they are processed.
| |
− | The file names will be printed in batches, similarly the amount of data triggered
| |
− | by defragmentation will be proportional to last N printed files. The system dirty
| |
− | memory throttling will slow down the defragmentation but there can still be a lot
| |
− | of IO load and the system may stall for a moment.</p>
| |
− | <p><b>$ btrfs filesystem defrag -v -r -f dir/</b></p>
| |
− | <p>Recursively defragment files under <em>dir/</em>, 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).</p>
| |
− | <p><b>$ btrfs filesystem defrag -v -r -f -clzo dir/</b></p>
| |
− | <p>Recursively defragment files under <em>dir/</em>, be verbose, wait until all blocks are
| |
− | flushed and force file compression.</p>
| |
− | <p><b>$ btrfs filesystem defrag -v -r -t 64M dir/</b></p>
| |
− | <p>Recursively defragment files under <em>dir/</em>, 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.</p>
| |
− | <p><b>$ btrfs filesystem resize -1G /path</b></p>
| |
− | <p><b>$ btrfs filesystem resize 1:-1G /path</b></p>
| |
− | <p>Shrink size of the filesystem’s device id 1 by 1GiB. The first syntax expects a
| |
− | device with id 1 to exist, otherwise fails. The second is equivalent and more
| |
− | explicit. For a single-device filesystem it’s typically not necessary to
| |
− | specify the devid though.</p>
| |
− | <p><b>$ btrfs filesystem resize max /path</b></p>
| |
− | <p><b>$ btrfs filesystem resize 1:max /path</b></p>
| |
− | <p>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 <em>max</em> as size we will achieve that.</p>
| |
− | <blockquote><b>Note:</b>
| |
− | There are two ways to minimize the filesystem on a given device. The
| |
− | <b>btrfs inspect-internal min-dev-size</b> command, or iteratively shrink in steps.</blockquote>
| |
− | ==EXIT STATUS==
| |
− |
| |
− | <p><b>btrfs filesystem</b> returns a zero exit status if it succeeds. Non zero is
| |
− | returned in case of failure.</p>
| |
− | ==AVAILABILITY==
| |
− |
| |
− | <p><b>btrfs</b> is part of btrfs-progs.
| |
− | Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
| |
− | further details.</p>
| |
− | ==SEE ALSO==
| |
− |
| |
− | <p>[[Manpage/btrfs-subvolume|btrfs-subvolume(8)]],
| |
− | [[Manpage/mkfs.btrfs|mkfs.btrfs(8)]],</p>
| |
− | [[Category:Manpage]]
| |