6 btrfs-subvolume - manage btrfs subvolumes
10 *btrfs subvolume* <subcommand> [<args>]
14 *btrfs subvolume* is used to create/delete/list/show btrfs subvolumes and
17 SUBVOLUME AND SNAPSHOT
18 ----------------------
20 A subvolume is a part of filesystem with it's own and independent
21 file/directory hierarchy. Subvolumes can share file extents. A snapshot is
22 also subvolume, but with a given initial content of the original subvolume.
24 NOTE: A subvolume in btrfs is not like an LVM logical volume, which is
25 block-level snapshot while btrfs subvolumes are file extent-based.
27 A subvolume looks like a normal directory, with some additional operations
28 described below. Subvolumes can be renamed or moved, nesting subvolumes is not
29 restricted but has some implications regarding snapshotting.
31 A subvolume in btrfs can be accessed in two ways:
33 * like any other directory that is accessible to the user
34 * like a separately mounted filesystem (options 'subvol' or 'subvolid')
36 In the latter case the parent directory is not visible and accessible. This is
37 similar to a bind mount, and in fact the subvolume mount does exactly that.
39 A freshly created filesystem is also a subvolume, called 'top-level',
40 internally has an id 5. This subvolume cannot be removed or replaced by another
41 subvolume. This is also the subvolume that will be mounted by default, unless
42 the default subvolume has been changed (see subcommand 'set-default').
44 A snapshot is a subvolume like any other, with given initial content. By
45 default, snapshots are created read-write. File modifications in a snapshot
46 do not affect the files in the original subvolume.
50 *create* [-i <qgroupid>] [<dest>]<name>::
51 Create a subvolume <name> in <dest>.
53 If <dest> is not given, subvolume <name> will be created in the current
59 Add the newly created subvolume to a qgroup. This option can be given multiple
62 *delete* [options] <subvolume> [<subvolume>...]::
63 Delete the subvolume(s) from the filesystem.
65 If <subvolume> is not a subvolume, btrfs returns an error but continues if
66 there are more arguments to process.
68 The corresponding directory is removed instantly but the data blocks are
69 removed later. The deletion does not involve full commit by default due to
70 performance reasons (as a consequence, the subvolume may appear again after a
71 crash). Use one of the '--commit' options to wait until the operation is safely
77 wait for transaction commit at the end of the operation
80 wait for transaction commit after deleting each subvolume
82 *find-new* <subvolume> <last_gen>::
83 List the recently modified files in a subvolume, after <last_gen> ID.
85 *get-default* <path>::
86 Get the default subvolume of the filesystem <path>.
88 The output format is similar to *subvolume list* command.
90 *list* [options] [-G [\+|-]<value>] [-C [+|-]<value>] [--sort=rootid,gen,ogen,path] <path>::
91 List the subvolumes present in the filesystem <path>.
93 For every subvolume the following information is shown by default. +
94 ID <ID> top level <ID> path <path> +
95 where path is the relative path of the subvolume to the top level subvolume.
96 The subvolume's ID may be used by the subvolume set-default command,
97 or at mount time via the subvolid= option.
98 If `-p` is given, then parent <ID> is added to the output between ID
99 and top level. The parent's ID may be used at mount time via the
100 `subvolrootid=` option.
107 print all the subvolumes in the filesystem and distinguish between
108 absolute and relative path with respect to the given <path>.
110 print the ogeneration of the subvolume, aliases: ogen or origin generation.
112 print the generation of the subvolume.
114 print only subvolumes below specified <path>.
116 print the UUID of the subvolume.
118 print the parent uuid of subvolumes (and snapshots).
120 print the UUID of the sent subvolume, where the subvolume is the result of a receive operation
122 print the result as a table.
124 only snapshot subvolumes in the filesystem will be listed.
126 only readonly subvolumes in the filesystem will be listed.
128 list subvolumes in the filesystem that its generation is
129 >=, \<= or = value. \'\+' means >= value, \'-' means \<= value, If there is
130 neither \'+' nor \'-', it means = value.
132 list subvolumes in the filesystem that its ogeneration is
133 >=, \<= or = value. The usage is the same to '-g' option.
134 --sort=rootid,gen,ogen,path::::
135 list subvolumes in order by specified items.
136 you can add \'\+' or \'-' in front of each items, \'+' means ascending,
137 \'-' means descending. The default is ascending.
139 for --sort you can combine some items together by \',', just like
140 -sort=+ogen,-gen,path,rootid.
142 *set-default* <id> <path>::
143 Set the subvolume of the filesystem <path> which is mounted as
146 The subvolume is identified by <id>, which is returned by the *subvolume list*
150 Show information of a given subvolume in the <path>.
152 *snapshot* [-r] <source> <dest>|[<dest>/]<name>::
153 Create a writable/readonly snapshot of the subvolume <source> with the
154 name <name> in the <dest> directory.
156 If only <dest> is given, the subvolume will be named the basename of <source>.
157 If <source> is not a subvolume, btrfs returns an error.
158 If '-r' is given, the snapshot will be readonly.
160 *sync* <path> [subvolid...]::
161 Wait until given subvolume(s) are completely removed from the filesystem
162 after deletion. If no subvolume id is given, wait until all current deletion
163 requests are completed, but do not wait for subvolumes deleted meanwhile.
164 The status of subvolume ids is checked periodically.
169 sleep N seconds between checks (default: 1)
173 *btrfs subvolume* returns a zero exit status if it succeeds. A non-zero value is
174 returned in case of failure.
178 *btrfs* is part of btrfs-progs.
179 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for