The software described in this documentation is either in Extended Support or Sustaining Support. See for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.

4.6 Creating Subvolumes and Snapshots

The top level of a btrfs file system is a subvolume consisting of a named b-tree structure that contains directories, files, and possibly further btrfs subvolumes that are themselves named b-trees that contain directories and files, and so on. To create a subvolume, change directory to the position in the btrfs file system where you want to create the subvolume and enter the following command:

# btrfs subvolume create subvolume_name

Snapshots are a type of subvolume that records the contents of their parent subvolumes at the time that you took the snapshot. If you take a snapshot of a btrfs file system and do not write to it, the snapshot records the state of the original file system and forms a stable image from which you can make a backup. If you make a snapshot writable, you can treat it as a alternate version of the original file system. The copy-on-write functionality of btrfs file system means that snapshots are quick to create, and consume very little disk space initially.


Taking snapshots of a subvolume is not a recursive process. If you create a snapshot of a subvolume, every subvolume or snapshot that the subvolume contains is mapped to an empty directory of the same name inside the snapshot.

The following table shows how to perform some common snapshot operations:



btrfs subvolume snapshot pathname pathname/snapshot_path

Create a snapshot snapshot_path of a parent subvolume or snapshot specified by pathname. For example:

btrfs subvolume snapshot /mybtrfs /mybtrfs/snapshot1

btrfs subvolume list pathname

List the subvolumes or snapshots of a subvolume or snapshot specified by pathname. For example:

btrfs subvolume list /mybtrfs


You can use this command to determine the ID of a subvolume or snapshot.

btrfs subvolume set-default ID pathname

By default, mount the snapshot or subvolume specified by its ID instead of the parent subvolume. For example:

btrfs subvolume set-default 4 /mybtrfs

btrfs subvolume get-default pathname

Displays the ID of the default subvolume that is mounted for the specified subvolume. For example:

btrfs subvolume get-default /mybtrfs

You can mount a btrfs subvolume as though it were a disk device. If you mount a snapshot instead of its parent subvolume, you effectively roll back the state of the file system to the time that the snapshot was taken. By default, the operating system mounts the parent btrfs volume, which has an ID of 0, unless you use set-default to change the default subvolume. If you set a new default subvolume, the system will mount that subvolume instead in future. You can override the default setting by specifying either of the following mount options:

Mount Option



Mount the subvolume or snapshot specified by its subvolume ID instead of the default subvolume.


Mount the subvolume or snapshot specified by its pathname instead of the default subvolume.


The subvolume or snapshot must be located in the root of the btrfs file system.

When you have rolled back a file system by mounting a snapshot, you can take snapshots of the snapshot itself to record its state.

When you no longer require a subvolume or snapshot, use the following command to delete it:

# btrfs subvolume delete subvolume_path


Deleting a subvolume deletes all subvolumes that are below it in the b-tree hierarchy. For this reason, you cannot remove the topmost subvolume of a btrfs file system, which has an ID of 0.