I have only 1 BTRFS partition that contains both / and /home.

I have snapshotted the root filesystem via the command:

btrfs subvolume snapshot / /root/snapshots/test

Now I want to restore this snapshot. How do I do that ?

When I boot into a rescue medium and mount I get:

# mount -t btrfs /dev/sda3 /mnt
# ls /mnt
# bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

As you can see my subvolume is not visible from here.

But when I do :

$ btrfs subvolume list /
ID 256 gen 3794 top level 5 path fedora
ID 264 gen 2296 top level 256 path root/snapshots/test

How do I restore this snapshot ?

Tutorials say that I have to rename the subvolume to the root. How do I do that ?

I have tried editing the /etc/fstab but it has no effect.


What you have is a BTRFS filesystem with two subvolumes:

  1. fedora - This is set as your default subvolume, and is what you see when you mount the filesystem without specifying specifying a subvolume. Ex. mount -t btrfs /dev/sda3 /mnt
  2. root/snapshots/test - This is the snapshot you created of fedora

In BTRFS there's really no such thing as restoring a snapshot. Instead you simply boot using a different subvolume as your root filesystem. There are a few of ways to do this.

Renaming the subvolume

To do this you first need to mount the top-level volume, which is always ID 5 and in your case does not mount by default. After that you can do a normal directory rename.

Note: This won't work in your case because your OS is configured to mount the default subvolume as the root filesystem, and this process won't change the default subvolume.

mount -t btrfs -o subvolid=5 /dev/sda3 /mnt
cd /mnt
mv fedora fedora-old
mv fedora-old/root/snapshots/test fedora

Changing the default subvolume

By changing the default subvolume, upon reboot your system will boot from the new default subvolume. The subvolume ID 264 shown below comes from your example btrfs subvolume list /

btrfs subvolume set-default 264 /

Changing the root subvolume in your bootloader

How this is done depends on your bootloader, but often the bootloader (ex. GRUB) contains a line of configuration that specifies what filesystem to mount as the root filesystem. That configuration can be changed to boot a different subvolume. Unfortunately I don't have an example to show. But know that this can't be done in /etc/fstab because that file is not read until later.


For your specific situation, I think you'll have the best results by changing the default subvolume.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.