Does not work when root system is not using @ subvol

Asked by Danny on 2021-01-31

I manually partitioned my HD before installing Ubuntu, consequently I ended up with a BTRFS volume where root is at root not at @ subvolume. Consequently is failing to recognize my volume as BTRFS as root is not at @. Will your script work if I just remove the check for root on @?

Danny Poulson.

Question information

English Edit question
Ubuntu apt-btrfs-snapshot Edit question
No assignee Edit question
Last query:
Last reply:
Vlado (vskoric) said : #2

I just created snapshot of / called @, edited fstab to mount it and rebooted

btrfs subvolume snapshot / /@

# btrfs subvolume list /
ID 265 gen 559 top level 5 path @

/dev/disk/by-uuid/796d6ce3-2138-45e1-aca9-3335164e2804 / btrfs defaults,subvolid=265,subvol=@ 0 0

and it appears to be working as expected

# apt-btrfs-snapshot supported
# apt-btrfs-snapshot list
Available snapshots:

Vlado (vskoric) said : #3

If you are using swapfile on btrfs / you will not be able to create snapshot, just disable swapfile on BTRFS or move it somewhere

Vlado (vskoric) said : #4

My suggestion is not complete as I just tricked apt-btrfs-snapshot by putting subvol=@ in etc fstab but on boot kernel mounted default root

 you need to mount @ by using kernel boot option rootflags=subvol=@ by editing /etc/default/grub and running grub-update

1) edit fstab for example
/dev/sda / btrfs,default,subvol=@
2) edit /etc/default/grub (add rootflags=subvol=@ to GRUB_CMDLINE_LINUX_DEFAULT (example below) and run update-grub
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity rootflags=subvol=@"
3) create snapshot of / called @
btrfs subvolume snapshot / /@


After reboot you should not see /@ on listing / directory ls -l /
# btrfs subvolume list /
ID 282 gen 2415 top level 5 path @

then just mount top level fs root somewhere so you can manually manipulate (move/rename) snapshots
btrfs subvolume set-default should not be used

I did not yet use apt-btrfs-snapshot set-default command, not sure what it does, maybe just mv chosen snapshot to @

Can you help with this problem?

Provide an answer of your own, or ask Danny for more information if necessary.

To post a message you must log in.