.TH BTRFS 8 "" "btrfs" "btrfs" .\" .\" Man page written by Goffredo Baroncelli (Feb 2010) .\" .SH NAME btrfs \- control a btrfs filesystem .SH SYNOPSIS \fBbtrfs\fP \fBsubvolume snapshot\fP\fI [-r] [/]\fP .PP \fBbtrfs\fP \fBsubvolume delete\fP\fI [...]\fP .PP \fBbtrfs\fP \fBsubvolume create\fP\fI [/]\fP .PP \fBbtrfs\fP \fBsubvolume list\fP\fI [-acgoprts] [-G [+|-]value] [-C [+|-]value] [--sort=rootid,gen,ogen,path] \fP .PP \fBbtrfs\fP \fBsubvolume set-default\fP\fI \fP .PP \fBbtrfs\fP \fBsubvolume get-default\fP\fI \fP .PP \fBbtrfs\fP \fBsubvolume find-new\fP\fI \fP .PP \fBbtrfs\fP \fBsubvolume show\fP\fI \fP .PP \fBbtrfs\fP \fBfilesystem defragment\fP -c[zlib|lzo] [-l \fIlen\fR] \ [-s \fIstart\fR] [-t \fIsize\fR] -[vf] <\fIfile\fR>|<\fIdir\fR> \ [<\fIfile\fR>|<\fIdir\fR>...] .PP \fBbtrfs\fP \fBfilesystem sync\fP\fI \fP .PP \fBbtrfs\fP \fBfilesystem resize\fP\fI [devid:][+/\-][gkm]|[devid:]max \fP .PP \fBbtrfs\fP \fBfilesystem label\fP\fI [newlabel]\fP .PP \fBbtrfs\fP \fBfilesystem balance\fP\fI \fP .PP \fBbtrfs\fP \fBdevice scan\fP\fI [--all-devices| [...]]\fP .PP \fBbtrfs\fP \fBdevice stats\fP [-z] {\fI\fP|\fI\fP} .PP \fBbtrfs\fP \fBdevice add\fP\fI [...] \fP .PP \fBbtrfs\fP \fBdevice delete\fP\fI [...] \fP .PP \fBbtrfs\fP \fBreplace start\fP \fI[-Bfr] | \fP .PP \fBbtrfs\fP \fBreplace status\fP \fI[-1] \fP .PP \fBbtrfs\fP \fBreplace cancel\fP \fI\fP .PP \fBbtrfs\fP \fBscrub start\fP [-Bdqru] [-c ioprio_class -n ioprio_classdata] {\fI\fP|\fI\fP} .PP \fBbtrfs\fP \fBscrub cancel\fP {\fI\fP|\fI\fP} .PP \fBbtrfs\fP \fBscrub resume\fP [-Bdqru] [-c ioprio_class -n ioprio_classdata] {\fI\fP|\fI\fP} .PP \fBbtrfs\fP \fBscrub status\fP [-d] {\fI\fP|\fI\fP} .PP \fBbtrfs\fP \fBinspect-internal inode-resolve\fP [-v] \fI\fP \fI\fP .PP \fBbtrfs\fP \fBinspect-internal logical-resolve\fP [-Pv] [-s size] \fI\fP \fI\fP .PP \fBbtrfs\fP \fBhelp|\-\-help \fP\fI\fP .PP \fBbtrfs\fP \fB \-\-help \fP\fI\fP .PP .SH DESCRIPTION .B 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 .I btrfs sub snaps instead of .I btrfs subvolume snapshot. But .I btrfs file s is not allowed, because .I file s may be interpreted both as .I filesystem show and as .I filesystem sync. In this case .I btrfs returns filesystem sync If a command is terminated by .I --help , the detailed help is showed. If the passed command matches more commands, detailed help of all the matched commands is showed. For example .I btrfs dev --help shows the help of all .I device* commands. .SH COMMANDS .TP \fBsubvolume snapshot\fR\fI [-r] [/]\fR Create a writable/readonly snapshot of the subvolume \fI\fR with the name \fI\fR in the \fI\fR directory. If \fI\fR is not a subvolume, \fBbtrfs\fR returns an error. If \fI-r\fR is given, the snapshot will be readonly. .TP \fBsubvolume delete\fR\fI [...]\fR Delete the subvolume \fI\fR. If \fI\fR is not a subvolume, \fBbtrfs\fR returns an error. .TP \fBsubvolume create\fR\fI [/]\fR Create a subvolume in \fI\fR (or in the current directory if \fI\fR is omitted). .TP \fBsubvolume list\fR\fI [-acgoprts] [-G [+|-]value] [-C [+|-]value] [--sort=rootid,gen,ogen,path] \fR .RS List the subvolumes present in the filesystem \fI\fR. For every subvolume the following information is shown by default. ID top level path where path is the relative path of the subvolume to the \fItop level\fR subvolume. The subvolume's ID may be used by the \fBsubvolume set-default\fR command, or at mount time via the \fIsubvolid=\fR option. If \fI-p\fR is given, then \fIparent \fR is added to the output between ID and top level. The parent's ID may be used at mount time via the \fIsubvolrootid=\fR option. \fB-t\fP print the result as a table. \fB-a\fP print all the subvolumes in the filesystem and distinguish between absolute and relative path with respect to the given . \fB-c\fP print the ogeneration of the subvolume, aliases: ogen or origin generation \fB-g\fP print the generation of the subvolume \fB-u\fP print the UUID of the subvolume \fB-o\fP print only subvolumes bellow specified . \fB-r\fP only readonly subvolumes in the filesystem will be listed. \fB-s\fP only snapshot subvolumes in the filesystem will be listed. \fB-G [+|-]value\fP list subvolumes in the filesystem that its generation is >=, <= or = value. '+' means >= value, '-' means <= value, If there is neither '+' nor '-', it means = value. \fB-C [+|-]value\fP list subvolumes in the filesystem that its ogeneration is >=, <= or = value. The usage is the same to '-g' option. \fB--sort=rootid,gen,ogen,path\fP list subvolumes in order by specified items. you can add '+' or '-' in front of each items, '+' means ascending, '-' means descending. The default is ascending. for \fB--sort\fP you can combine some items together by ',', just like \f--sort=+ogen,-gen,path,rootid\fR. .RE .TP \fBsubvolume set-default\fR\fI \fR Set the subvolume of the filesystem \fI\fR which is mounted as \fIdefault\fR. The subvolume is identified by \fI\fR, which is returned by the \fBsubvolume list\fR command. .TP \fBsubvolume get-default\fR\fI \fR Get the default subvolume of the filesystem \fI\fR. The output format is similar to \fBsubvolume list\fR command. .TP \fBsubvolume find-new\fR\fI \fR List the recently modified files in a subvolume, after \fI\fR ID. .TP \fBsubvolume show\fR\fI \fR Show information of a given subvolume in the \fI\fR. .TP \fBfilesystem defragment\fP -c[zlib|lzo] [-l \fIlen\fR] [-s \fIstart\fR] \ [-t \fIsize\fR] -[vf] <\fIfile\fR>|<\fIdir\fR> [<\fIfile\fR>|<\fIdir\fR>...] Defragment file data and/or directory metadata. To defragment all files in a directory you have to specify each one on its own or use your shell wildcards. The start position and the number of bytes to defragment can be specified by \fIstart\fR and \fIlen\fR. Any extent bigger than threshold will be considered already defragged. Use 0 to take the kernel default, and use 1 to say every single extent must be rewritten. You can also turn on compression in defragment operations. \fB-v\fP be verbose \fB-c\fP compress file contents while defragmenting \fB-f\fP flush filesystem after defragmenting \fB-s start\fP defragment only from byte \fIstart\fR onward \fB-l len\fP defragment only up to \fIlen\fR bytes \fB-t size\fP defragment only files at least \fIsize\fR bytes big For \fBstart\fP, \fBlen\fP, \fBsize\fP it is possible to append a suffix like \fBk\fP for 1 KBytes, \fBm\fP for 1 MBytes... NOTE: defragmenting with kernels up to 2.6.37 will unlink COW-ed copies of data, don't use it if you use snapshots, have de-duplicated your data or made copies with \fBcp --reflink\fP. .TP \fBfilesystem sync\fR\fI \fR Force a sync for the filesystem identified by \fI\fR. .TP .\" .\" Some wording are extracted by the resize2fs man page .\" \fBfilesystem resize\fR\fI [devid:][+/\-][gkm]|[devid:]max \fR Resize a filesystem identified by \fI\fR for the underlying device \fIdevid\fR. The \fIdevid\fR can be found with \fBbtrfs filesystem show\fR and defaults to 1 if not specified. The \fI\fR parameter specifies the new size of the filesystem. If the prefix \fI+\fR or \fI\-\fR is present the size is increased or decreased by the quantity \fI\fR. If no units are specified, the unit of the \fI\fR parameter defaults to bytes. Optionally, the size parameter may be suffixed by one of the following units designators: 'K', 'M', or 'G', kilobytes, megabytes, or gigabytes, respectively. If 'max' is passed, the filesystem will occupy all available space on the device \fIdevid\fR. The \fBresize\fR command \fBdoes not\fR 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 \fBfdisk(8)\fR or \fBparted(8)\fR to delete the existing partition and recreate it with the new desired size. When recreating the partition make sure to use the same starting disk cylinder as before. .TP \fBfilesystem label\fP\fI [newlabel]\fP Show or update the label of a filesystem. \fI\fR is used to identify the filesystem. If a \fInewlabel\fR optional argument is passed, the label is changed. The following constraints exist for a label: .IP - the maximum allowable length shall be less or equal than 256 chars .IP - the label shall not contain the '/' or '\\' characters. NOTE: Currently there are the following limitations: .IP - the filesystem has to be unmounted .IP - the filesystem should not have more than one device. .TP \fBfilesystem show\fR [--all-devices||