btrfs
is used to control the filesystem and the files and directories stored. It is
the tool to create or destroy a snapshot or a subvolume for the
filesystem, to defrag a file or a directory, flush the data to the disk,
to resize the filesystem, to scan the device.
It is possible to abbreviate the commands unless the commands are ambiguous.
For example: it is possible to run
btrfs sub snaps
instead of
btrfs subvolume snapshot.
But
btrfs dev s
is not allowed, because
dev s
may be interpreted both as
device show
and as
device scan.
In this case
btrfs
returns an error.
If a command is terminated by
--help
, the relevant help is showed. If the passed command matches more commands,
the help of all the matched commands are showed. For example
btrfs dev --help
shows the help of all
device*
command.
COMMANDS
subvolume snapshot <source> [<dest>/]<name>
Create a writable snapshot of the subvolume <source> with the name
<name> in the <dest> directory. If <source> is not a
subvolume, btrfs returns an error.
subvolume delete <subvolume>
Delete the subvolume <subvolume>. If <subvolume> is not a
subvolume, btrfs returns an error.
subvolume create [<dest>/]<name>
Create a subvolume in <dest> (or in the current directory if
<dest> is omitted).
subvolume list <path>
List the subvolumes present in the filesystem <path>. For every
subvolume is showed the subvolume ID (second column),
the ID of the top level
subvolume (fifth column), and the path (seventh column) relative to the
top level subvolume.
These <ID> may be used by the subvolume set-default command, or at
mount time via the subvol= option.
subvolume set-default <id> <path>
Set the subvolume of the filesystem <path> which is mounted as
default. The subvolume is identified by <id>, which
is returned by the subvolume list command.
device scan[<device> [<device>..]]
Scan devices for a btrfs filesystem. If no devices are passed, btrfs scans
all the block devices.
filesystem sync <path>
Force a sync for the filesystem identified by <path>.
filesystem resize [+/-]<size>[gkm]|max <path>
Resize a filesystem identified by <path>.
The <size> parameter specifies the new size of the filesystem.
If the prefix + or - is present the size is increased or decreased
by the quantity <size>.
If no units are specified, the unit of the <size> parameter defaults to
bytes. Optionally, the size parameter may be suffixed by one of the following
the units designators: 'K', 'M', or 'G', kilobytes, megabytes, or gigabytes,
respectively.
If 'max' is passed, the filesystem will occupy all available space on the
volume(s).
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.
filesystem show [<uuid>|<label>]
Show the btrfs filesystem with some additional info. If no UUID or label is
passed, btrfs show info of all the btrfs filesystem.
device balance<path>
Balance the chunks of the filesystem identified by <path>
across the devices.
device add <dev> [<dev>..] <path>
Add device(s) to the filesystem identified by <path>.
device delete <dev> [<dev>..] <path>
Remove device(s) from a filesystem identified by <path>.
EXIT STATUS
btrfs returns a zero exist status if it succeeds. Non zero is returned in
case of failure.
AVAILABILITY
btrfs
is part of btrfs-progs. Btrfs filesystem is currently under heavy development,
and not suitable for any uses other than benchmarking and review.
Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
further details.