Email or username:

Password:

Forgot your password?
Top-level
tippfehlr

@akhil
> This setup will make all snapshots created by Snapper be stored outside of the @ subvolume. This allows replacing @ without losing the snapshots.

I have seen this multiple times already, but as with all other subvolumes, they are automounted when the parent subvolume is mounted and aren't included in snapshots, just like @/var/cache

So @/.snapshots and @ snapshots works just the same (except @/.snapshots gets automounted).

Correct me if I'm wrong.

#archlinux #btrfs

6 comments
AkhIL

@tippfehlr
You place any number of subvolumes in to main subvolume (subvolid=5), the same place where @ and @snapshots are placesd, and then add all you subvolumes into fstab using subvol mount option. So the root subvolume does not contain any nested subvolumes, caches, logs and whatever you would not want to keep in your snapshots.

You may try to install #Garuda or #EndeavourOS and #OpenSUSE in VM with btrfs root and see how partitioning is done there.

Also I prefer snapper's / OpenSUSE way to mount root subvolume from mutable snapshot but in Arch this requires some hacks to get it done.

@tippfehlr
You place any number of subvolumes in to main subvolume (subvolid=5), the same place where @ and @snapshots are placesd, and then add all you subvolumes into fstab using subvol mount option. So the root subvolume does not contain any nested subvolumes, caches, logs and whatever you would not want to keep in your snapshots.

tippfehlr

@akhil that explains it – although instead of

mv /mnt/subvol_root /mnt/subvol_root.broken
btrfs subvol snapshot /mnt/snapshots/X/snapshot /mnt/subvol_root

i could also do

btrfs subvol snapshot -r /mnt/@ /mnt/@ backup
fd -E /mnt/@/.snapshots /mnt/@ -x rm -rf
mv /mnt/@/.snapshots/^/snapshot/* /mnt/@/

the first is harder to mess up though, true.
I guess I should migrate :)

AkhIL

@tippfehlr
If you remove this line from /etc/grub.d/10_linux:
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
re-run `grub-mkconfig -o /boot/grub/grub.cfg`, remove root's `subvol` option from the fstab, to allow the system boot from the default btrfs subvolume set by `btrfs subvolume set-default`, and then run:
snapper create
snapper --ambit classic rollback <snapshot id>
and reboot.

Then you can drop your @ subvolume and use snapper's rollback command to rollback the root.

Make sure you actually using snapshot as the live root before removing your @ subvolume. I had to repair my system with a bootable flash drive because I did not know about the subvol option in the grub config.

@tippfehlr
If you remove this line from /etc/grub.d/10_linux:
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
re-run `grub-mkconfig -o /boot/grub/grub.cfg`, remove root's `subvol` option from the fstab, to allow the system boot from the default btrfs subvolume set by `btrfs subvolume set-default`, and then run:
snapper create
snapper --ambit classic rollback <snapshot id>
and reboot.

tippfehlr

@akhil that seems like a nice config :)
I don't use grub though, currently using systemd-boot. Maybe refind at some point.
If I need to actually rollback I'll probably do it manually

AkhIL

@tippfehlr systemd-boot config also has hardcoded subvolume in Arch. Let me know if you find what should be modified to get systemd-boot use the default subvolume.

Go Up