Mounting Btrfs Subvolumes

You can mount subvolumes by subvolume ID or path. This facility makes it easy to access and switch out the subvolumes that are used at different mount points. Most notably, you can use the ability to mount specified subvolumes to easily rollback a mount point to use a particular snapshot.

  1. Mount a subvolume to a specified mount point by using the mount command and specify the subvolid option or by using the subvol option.

    You can mount any subvolume or snapshot by specifying its subvolume ID or subvolume path as an option when running the mount command. For example, to mount using the subvolume ID:

    sudo mount -o "subvolid=256" /dev/sdb /home

    You can get the subvolume ID for any subvolume or snapshot by using the btrfs subvolume list command.

    To mount a subvolume by specifying its subvolume path, you can run:

    sudo mount -o "subvol=/snapshots/home_2025-01-24" /dev/sdb /home

    Note:

    When mounting the subvolume by using the subvol option, the subvolume path must exist within the root subvolume of the Btrfs file system, even if that location is nested. You can't mount a subvolume by path if it's a subvolume of another subvolume. If you need to mount a nested subvolume, mount it by using the subvolid option.
  2. Set the default ID for a Btrfs file system to use when it's mounted by using the btrfs subvolume set-default command.

    You can change the default subvolume ID that the system uses when mounting a Btrfs file system. This operation is often useful when you're trying to rollback a system mount to a previous snapshot. To change the default subvolume ID, run:

    sudo btrfs subvolume set-default 256 /mnt

    When the file system is next mounted, the subvolume specified by the value that you set is loaded as the default subvolume and attached to the mount point.

    You can check the current default subvolume ID for the file system by running the btrfs subvolume get-default command.

    Setting the default subvolume ID is useful if trying to configure a root file system to use a snapshot to rollback to a previous point in time. See Working With a Btrfs root File System for more information.