I have a Btrfs partition which has a single subvolume at the top level (/root
). It has subvol=root
option in /etc/fstab.
Every week, I take a readonly snapshot into /root/snapshots/...
using:
btrfs subvolume snapshot -r / /snapshots/"$(date --rfc-3339=date)"
(paths don't have /root
because it's mounted as subvol=root
).
Now let's say something went wrong and I wanted to restore my root subvolume from a snapshot, I boot from a USB disk and mount the partition as /mnt/disk
without subvol=root
. If I try to run:
btrfs subvolume snapshot /mnt/disk/root/snapshots/2015-05-01 /mnt/disk/root
It creates the new subvolume as /mnt/disk/root/2015-05-01
instead of replacing /mnt/disk/root/
. If I try to delete it first by running
btrfs subvolume delete /mnt/disk/root
It gives the error message:
ERROR: cannot delete '/mnt/disk/root' - Directory not empty
Is there a way to do this? Or should I get into the habit of creating snapshots outside the subvolume being snapshotted?