Manpage/btrfs-subvolume

From btrfs Wiki
(Difference between revisions)
Jump to: navigation, search
(Update from git, v4.5.3)
(Update from git, v4.5.3)
Line 1: Line 1:
=btrfs-subvolume(8)=
+
=btrfs-subvolume(8) manual page=
 
{{GeneratedManpage
 
{{GeneratedManpage
 
|name=btrfs-subvolume}}
 
|name=btrfs-subvolume}}
Line 8: Line 8:
 
==SYNOPSIS==
 
==SYNOPSIS==
  
<p><b>btrfs subvolume</b> <emphasis>&lt;subcommand&gt;</emphasis> [<emphasis>&lt;args&gt;</emphasis>]</p>
+
<p><b>btrfs subvolume</b> <em>&lt;subcommand&gt;</em> [<em>&lt;args&gt;</em>]</p>
 
==DESCRIPTION==
 
==DESCRIPTION==
  
Line 22: Line 22:
 
<li>
 
<li>
 
<p>
 
<p>
From the parent subvolume<text:line-break/>
+
From the parent subvolume<br/>
 
When accessing from the parent subvolume, the subvolume can be used just
 
When accessing from the parent subvolume, the subvolume can be used just
 
like a directory. It can have child subvolumes and its own files/directories.
 
like a directory. It can have child subvolumes and its own files/directories.
Line 29: Line 29:
 
<li>
 
<li>
 
<p>
 
<p>
Separate mounted filesystem<text:line-break/>
+
Separate mounted filesystem<br/>
 
When [http://man7.org/linux/man-pages/man8/mount.8.html mount(8)] using <em>subvol</em> or <em>subvolid</em> mount option, one can access
 
When [http://man7.org/linux/man-pages/man8/mount.8.html mount(8)] using <em>subvol</em> or <em>subvolid</em> mount option, one can access
 
files/directories/subvolumes inside it, but nothing in parent subvolumes.
 
files/directories/subvolumes inside it, but nothing in parent subvolumes.
Line 47: Line 47:
 
<dl>
 
<dl>
 
<dt>
 
<dt>
<b>create</b> [-i <emphasis>&lt;qgroupid&gt;</emphasis>] [&lt;dest&gt;]<emphasis>&lt;name&gt;</emphasis>
+
<b>create</b> [-i <em>&lt;qgroupid&gt;</em>] [&lt;dest&gt;]<em>&lt;name&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
Create a subvolume <emphasis>&lt;name&gt;</emphasis> in <emphasis>&lt;dest&gt;</emphasis>.
+
Create a subvolume <em>&lt;name&gt;</em> in <em>&lt;dest&gt;</em>.
 
</p>
 
</p>
<p>If <emphasis>&lt;dest&gt;</emphasis> is not given, subvolume <emphasis>&lt;name&gt;</emphasis> will be created in the currently
+
<p>If <em>&lt;dest&gt;</em> is not given, subvolume <em>&lt;name&gt;</em> will be created in the currently
 
directory.</p>
 
directory.</p>
 
<p><tt>Options</tt></p>
 
<p><tt>Options</tt></p>
 
<dl>
 
<dl>
 
<dt>
 
<dt>
-i <emphasis>&lt;qgroupid&gt;</emphasis>
+
-i <em>&lt;qgroupid&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
Line 67: Line 67:
  
 
<dt>
 
<dt>
<b>delete</b> [options] <emphasis>&lt;subvolume&gt;</emphasis> [<emphasis>&lt;subvolume&gt;</emphasis>&#8230;]
+
<b>delete</b> [options] <em>&lt;subvolume&gt;</em> [<em>&lt;subvolume&gt;</em>&#8230;]
 
<dd>
 
<dd>
 
<p>
 
<p>
 
Delete the subvolume(s) from the filesystem.
 
Delete the subvolume(s) from the filesystem.
 
</p>
 
</p>
<p>If <emphasis>&lt;subvolume&gt;</emphasis> is not a subvolume, btrfs returns an error but continues if
+
<p>If <em>&lt;subvolume&gt;</em> is not a subvolume, btrfs returns an error but continues if
 
there are more arguments to process.</p>
 
there are more arguments to process.</p>
 
<p>The corresponding directory is removed instantly but the data blocks are
 
<p>The corresponding directory is removed instantly but the data blocks are
Line 98: Line 98:
  
 
<dt>
 
<dt>
<b>find-new</b> <emphasis>&lt;subvolume&gt;</emphasis> <emphasis>&lt;last_gen&gt;</emphasis>
+
<b>find-new</b> <em>&lt;subvolume&gt;</em> <em>&lt;last_gen&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
List the recently modified files in a subvolume, after <emphasis>&lt;last_gen&gt;</emphasis> ID.
+
List the recently modified files in a subvolume, after <em>&lt;last_gen&gt;</em> ID.
 
</p>
 
</p>
  
 
<dt>
 
<dt>
<b>get-default</b> <emphasis>&lt;path&gt;</emphasis>
+
<b>get-default</b> <em>&lt;path&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
Get the default subvolume of the filesystem <emphasis>&lt;path&gt;</emphasis>.
+
Get the default subvolume of the filesystem <em>&lt;path&gt;</em>.
 
</p>
 
</p>
 
<p>The output format is similar to <b>subvolume list</b> command.</p>
 
<p>The output format is similar to <b>subvolume list</b> command.</p>
  
 
<dt>
 
<dt>
<b>list</b> [options] [-G [+|-]<emphasis>&lt;value&gt;</emphasis>] [-C [+|-]<emphasis>&lt;value&gt;</emphasis>] [--sort=rootid,gen,ogen,path] <emphasis>&lt;path&gt;</emphasis>
+
<b>list</b> [options] [-G [+|-]<em>&lt;value&gt;</em>] [-C [+|-]<em>&lt;value&gt;</em>] [--sort=rootid,gen,ogen,path] <em>&lt;path&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
List the subvolumes present in the filesystem <emphasis>&lt;path&gt;</emphasis>.
+
List the subvolumes present in the filesystem <em>&lt;path&gt;</em>.
 
</p>
 
</p>
<p>For every subvolume the following information is shown by default.<text:line-break/>
+
<p>For every subvolume the following information is shown by default.<br/>
ID <emphasis>&lt;ID&gt;</emphasis> top level <emphasis>&lt;ID&gt;</emphasis> path <emphasis>&lt;path&gt;</emphasis><text:line-break/>
+
ID <em>&lt;ID&gt;</em> top level <em>&lt;ID&gt;</em> path <em>&lt;path&gt;</em><br/>
 
where path is the relative path of the subvolume to the top level subvolume.
 
where path is the relative path of the subvolume to the top level subvolume.
 
The subvolume&#8217;s ID may be used by the subvolume set-default command,
 
The subvolume&#8217;s ID may be used by the subvolume set-default command,
 
or at mount time via the subvolid= option.
 
or at mount time via the subvolid= option.
If <tt>-p</tt> is given, then parent <emphasis>&lt;ID&gt;</emphasis> is added to the output between ID
+
If <tt>-p</tt> is given, then parent <em>&lt;ID&gt;</em> is added to the output between ID
 
and top level. The parent&#8217;s ID may be used at mount time via the
 
and top level. The parent&#8217;s ID may be used at mount time via the
 
<tt>subvolrootid=</tt> option.</p>
 
<tt>subvolrootid=</tt> option.</p>
Line 140: Line 140:
 
<p>
 
<p>
 
print all the subvolumes in the filesystem and distinguish between
 
print all the subvolumes in the filesystem and distinguish between
absolute and relative path with respect to the given <emphasis>&lt;path&gt;</emphasis>.
+
absolute and relative path with respect to the given <em>&lt;path&gt;</em>.
 
</p>
 
</p>
  
Line 161: Line 161:
 
<dd>
 
<dd>
 
<p>
 
<p>
print only subvolumes below specified <emphasis>&lt;path&gt;</emphasis>.
+
print only subvolumes below specified <em>&lt;path&gt;</em>.
 
</p>
 
</p>
  
Line 207: Line 207:
  
 
<dt>
 
<dt>
-G [+|-]<emphasis>&lt;value&gt;</emphasis>
+
-G [+|-]<em>&lt;value&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
Line 216: Line 216:
  
 
<dt>
 
<dt>
-C [+|-]<emphasis>&lt;value&gt;</emphasis>
+
-C [+|-]<em>&lt;value&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
Line 237: Line 237:
  
 
<dt>
 
<dt>
<b>set-default</b> <emphasis>&lt;id&gt;</emphasis> <emphasis>&lt;path&gt;</emphasis>
+
<b>set-default</b> <em>&lt;id&gt;</em> <em>&lt;path&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
Set the subvolume of the filesystem <emphasis>&lt;path&gt;</emphasis> which is mounted as
+
Set the subvolume of the filesystem <em>&lt;path&gt;</em> which is mounted as
 
default.
 
default.
 
</p>
 
</p>
<p>The subvolume is identified by <emphasis>&lt;id&gt;</emphasis>, which is returned by the <b>subvolume list</b>
+
<p>The subvolume is identified by <em>&lt;id&gt;</em>, which is returned by the <b>subvolume list</b>
 
command.</p>
 
command.</p>
  
 
<dt>
 
<dt>
<b>show</b> <emphasis>&lt;path&gt;</emphasis>
+
<b>show</b> <em>&lt;path&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
Show information of a given subvolume in the <emphasis>&lt;path&gt;</emphasis>.
+
Show information of a given subvolume in the <em>&lt;path&gt;</em>.
 
</p>
 
</p>
  
 
<dt>
 
<dt>
<b>snapshot</b> [-r] <emphasis>&lt;source&gt;</emphasis> <emphasis>&lt;dest&gt;</emphasis>|[&lt;dest&gt;/]<emphasis>&lt;name&gt;</emphasis>
+
<b>snapshot</b> [-r] <em>&lt;source&gt;</em> <em>&lt;dest&gt;</em>|[&lt;dest&gt;/]<em>&lt;name&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>
Create a writable/readonly snapshot of the subvolume <emphasis>&lt;source&gt;</emphasis> with the
+
Create a writable/readonly snapshot of the subvolume <em>&lt;source&gt;</em> with the
name <emphasis>&lt;name&gt;</emphasis> in the <emphasis>&lt;dest&gt;</emphasis> directory.
+
name <em>&lt;name&gt;</em> in the <em>&lt;dest&gt;</em> directory.
 
</p>
 
</p>
<p>If only <emphasis>&lt;dest&gt;</emphasis> is given, the subvolume will be named the basename of <emphasis>&lt;source&gt;</emphasis>.
+
<p>If only <em>&lt;dest&gt;</em> is given, the subvolume will be named the basename of <em>&lt;source&gt;</em>.
If <emphasis>&lt;source&gt;</emphasis> is not a subvolume, btrfs returns an error.
+
If <em>&lt;source&gt;</em> is not a subvolume, btrfs returns an error.
 
If <em>-r</em> is given, the snapshot will be readonly.</p>
 
If <em>-r</em> is given, the snapshot will be readonly.</p>
  
 
<dt>
 
<dt>
<b>sync</b> <emphasis>&lt;path&gt;</emphasis> [subvolid&#8230;]
+
<b>sync</b> <em>&lt;path&gt;</em> [subvolid&#8230;]
 
<dd>
 
<dd>
 
<p>
 
<p>
Line 276: Line 276:
 
<dl>
 
<dl>
 
<dt>
 
<dt>
-s <emphasis>&lt;N&gt;</emphasis>
+
-s <em>&lt;N&gt;</em>
 
<dd>
 
<dd>
 
<p>
 
<p>

Revision as of 10:36, 20 May 2016

Contents

btrfs-subvolume(8) manual page

Note: manual pages are located at read-the-docs site, please update your links.



NAME

btrfs-subvolume - control btrfs subvolume(s)

SYNOPSIS

btrfs subvolume <subcommand> [<args>]

DESCRIPTION

btrfs subvolume is used to control the filesystem to create/delete/list/show subvolumes and snapshots.

SUBVOLUME AND SNAPSHOT

A subvolume in btrfs is not like an LVM logical volume, which is quite independent from each other, a btrfs subvolume has its hierarchy and relations between other subvolumes.

A subvolume in btrfs can be accessed in two ways.

  1. From the parent subvolume
    When accessing from the parent subvolume, the subvolume can be used just like a directory. It can have child subvolumes and its own files/directories.

  2. Separate mounted filesystem
    When mount(8) using subvol or subvolid mount option, one can access files/directories/subvolumes inside it, but nothing in parent subvolumes.

Also every btrfs filesystem has a default subvolume as its initially top-level subvolume, whose subvolume id is 5. (0 is also acceptable as an alias.)

A btrfs snapshot is much like a subvolume, but shares its data(and metadata) with other subvolume/snapshot. Due to the capabilities of COW, modifications inside a snapshot will only show in a snapshot but not in its source subvolume.

Although in btrfs, subvolumes/snapshots are treated as directories, only subvolume/snapshot can be the source of a snapshot, snapshot can not be made from normal directories.

SUBCOMMAND

create [-i <qgroupid>] [<dest>]<name>

Create a subvolume <name> in <dest>.

If <dest> is not given, subvolume <name> will be created in the currently directory.

Options

-i <qgroupid>

Add the newly created subvolume to a qgroup. This option can be given multiple times.

delete [options] <subvolume> [<subvolume>…]

Delete the subvolume(s) from the filesystem.

If <subvolume> is not a subvolume, btrfs returns an error but continues if there are more arguments to process.

The corresponding directory is removed instantly but the data blocks are removed later. The deletion does not involve full commit by default due to performance reasons (as a consequence, the subvolume may appear again after a crash). Use one of the --commit options to wait until the operation is safely stored on the media.

Options

-c|--commit-after

wait for transaction commit at the end of the operation

-C|--commit-each

wait for transaction commit after deleting each subvolume

find-new <subvolume> <last_gen>

List the recently modified files in a subvolume, after <last_gen> ID.

get-default <path>

Get the default subvolume of the filesystem <path>.

The output format is similar to subvolume list command.

list [options] [-G [+|-]<value>] [-C [+|-]<value>] [--sort=rootid,gen,ogen,path] <path>

List the subvolumes present in the filesystem <path>.

For every subvolume the following information is shown by default.
ID <ID> top level <ID> path <path>
where path is the relative path of the subvolume to the top level subvolume. The subvolume’s ID may be used by the subvolume set-default command, or at mount time via the subvolid= option. If -p is given, then parent <ID> is added to the output between ID and top level. The parent’s ID may be used at mount time via the subvolrootid= option.

Options

-p

print parent ID.

-a

print all the subvolumes in the filesystem and distinguish between absolute and relative path with respect to the given <path>.

-c

print the ogeneration of the subvolume, aliases: ogen or origin generation.

-g

print the generation of the subvolume.

-o

print only subvolumes below specified <path>.

-u

print the UUID of the subvolume.

-q

print the parent uuid of subvolumes (and snapshots).

-R

print the UUID of the sent subvolume, where the subvolume is the result of a receive operation

-t

print the result as a table.

-s

only snapshot subvolumes in the filesystem will be listed.

-r

only readonly subvolumes in the filesystem will be listed.

-G [+|-]<value>

list subvolumes in the filesystem that its generation is >=, ⇐ or = value. '+' means >= value, '-' means <= value, If there is neither '+' nor '-', it means = value.

-C [+|-]<value>

list subvolumes in the filesystem that its ogeneration is >=, <= or = value. The usage is the same to -g option.

--sort=rootid,gen,ogen,path

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 --sort you can combine some items together by ',', just like -sort=+ogen,-gen,path,rootid.

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.

show <path>

Show information of a given subvolume in the <path>.

snapshot [-r] <source> <dest>|[<dest>/]<name>

Create a writable/readonly snapshot of the subvolume <source> with the name <name> in the <dest> directory.

If only <dest> is given, the subvolume will be named the basename of <source>. If <source> is not a subvolume, btrfs returns an error. If -r is given, the snapshot will be readonly.

sync <path> [subvolid…]

Wait until given subvolume(s) are completely removed from the filesystem after deletion. If no subvolume id is given, wait until all current deletion requests are completed, but do not wait for subvolumes deleted meanwhile. The status of subvolume ids is checked periodically.

Options

-s <N>

sleep N seconds between checks (default: 1)

EXIT STATUS

btrfs subvolume returns a zero exit status if it succeeds. A non-zero value is returned in case of failure.

AVAILABILITY

btrfs is part of btrfs-progs. Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for further details.

SEE ALSO

mkfs.btrfs(8), btrfs-quota(8), btrfs-qgroup(8),

Personal tools