2

I have Fedora 20 and when I installed it I choose to go with btrfs as file system, by many reasons but mainly to have snapshots available.

But I can't seem to create a snapshot of /. I can snapshot my home folder (which also is btrfs) like this btrfs subvolume snapshot /home/ /snap/home, but when I try to snapshot / by writing btrfs subvolume snapshot / /snap it just outputs ERROR: incorrect snapshot name ('/').

I am sure that / is btrfs. gparted

Listing subvolumes outputs:

# btrfs subvolume list /
ID 256 gen 9562 top level 5 path home
ID 258 gen 9562 top level 5 path root
ID 306 gen 9517 top level 258 path snap/home/2014-08-15_00:44:00

Is it not possible to snapshot the root folder, even if it is using btrfs?

7

You need to provide a name for the snapshot under /snap e.g.

$ btrfs subvolume snapshot / /snap/root

If you don't provide a name btrfs will use the name of the source subvolume. In your case the source subvolume is called / which is not a valid name for the snapshot.

usage: btrfs subvolume snapshot [-r] <source> <dest>|[<dest>/]<name>

    btrfs subvolume snapshot [-r] [-i <qgroupid>] <source> <dest>|[<dest>/]<name>

    Create a snapshot of the subvolume
    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>.

    -r             create a readonly snapshot
    -i <qgroupid>  add the newly created snapshot to a qgroup. This
                   option can be given multiple times.
1

If you want to preserve your root system you may wish to do this

mkdir /. snapshots
btrfs subvolume snapshot / /.snapshots/24072018
nano /.snapshots/24072018/etc/fstab

UUID=XXXXXXXX     /    btrfs    defaults, subvol=root/.snapshots/24072018  0      1

It's common for Fedora this days when you format your system with btrfs to create a subvolume called root, so if you didn't find the subvol option in fstab, then omit root from subvol.

The next step will to reboot your system. When the system starts up you will see the grub booting menu.

  • Press e on the default entry
  • Scroll down until you find the subvol option if Fedora was installed on a subvolume. If not you will have to find the rootflags option and write the following :

    • rootflags=subvol=.snapshots/24072018

      Or for the case the system was installed on a subvolume:

    • rootflags=subvol=root/.snapshots/24072018

Note that if the system was not installed on a subvolume it's unlikely you'll see the rootflags option in the grub entry, so you must write the rootflags parameter next to the "ro" parameter for this to work.

After booting successfully to your system, open the terminal, login to the root account, and update your grub configurations if you want to make the changes permanent.

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.