Need a little help with manual btrfs snapshots management

I just want to make sure if I understood btrfs manpages correctly

Currently on my disk (sda1) I have subvolumes:
@ for /
@home for /home
@cache for /var/cache

I wanted to do some tests with files in my home directory.
Let say that I want to create snapshot of home called home_snap
delete something from desktop
restore home_snap as home

Should it look like this:
mount -o subvolid=5 /dev/sda1 /mnt
btrfs subvolume snapshot /mnt/@home /mnt/@home_snap
umount /mnt
Do some changes in my home directory
Edit fstab and change option subvol=@home to @home_snap
reboot - system will reboot into snapshot
btrfs subvolume delete @home
mount -o subvolid=5 /dev/sda1 /mnt
btrfs subvolume snapshot /mnt/@home_snap /mnt/@home
edit fstab and change subvol=@home_snap to @home

Is that the correct way?
I wanted to do snapshot without mounting top level subvolume
something like:
btrfs subvolume snapshot /home /home_snap
But I end up with home_snap inside my root directory
The long way gives me:
sda1
|__ @ @home @home_snap @cache

short way gives me:

sda1
|__ @ @home @cache
    |__@home_snap

So Is the long way the good way?
Or I just miss some option or something in short way?

Not having nested subvolumes is usually better. Flat subvolume layout for the win

You may have a look at

https://wiki.manjaro.org/index.php/Btrfs

1 Like