You are not logged in.

#1 2021-06-16 11:27:50

VVishion
Member
Registered: 2021-06-15
Posts: 9

Best practise btrfs default subvolume

I use btrfs as my linux fs.

The layout is like this

@          /
@home      /home
@snapshots /.snapshots
@log       /var/log
@cache     /var/cache
@tmp       /var/tmp

I ran into the problem having to specify the root subvolume to be mounted by the bootloader with

rootflags=subvol=@

because the default subvolume for this volume is the btrfs fs(-tree), which is the container for all subvolumes.

I was told I can achieve the same thing by setting the default subvolume to @ instead of the btrfs fs(-tree).
What is best practice for this example and for future system, backup/snapshot, fs management?

Another example: If the default subvolume is @ instead of the fs tree and I wanted to edit my btrfs layout. Is there a reasonable danger of not manipulating the fs tree, but the root partition, because the root subvolume was mounted?

Another thought: If you know btrfs and its structure. Then, it is intuitive that there are all subvolumes at the top. Changing the default subvolume would then disconnect the way btrfs is structured and how the volume is mapped, wouldnt it?

So leave it as is with the fs-tree at the top or make the @ subvolume the default subvolume?

Last edited by VVishion (2021-06-16 11:29:02)

Offline

#2 2021-06-17 04:28:01

zenbum
Member
From: California
Registered: 2020-02-29
Posts: 8

Re: Best practise btrfs default subvolume

If you want to rollback your @ (root) subvolume to a snapshot, then you should keep any subvolumes that need to be mounted directly onto @ in the top of the fs-tree. This is how you currently have them.

If you want to use automated rollback tools (like snapper rollback) then the root subvol needs to be the default, rather than hardcoded as a kernel parameter. In that case, if you're using grub as your bootloader, you would have to edit /etc/grub.d/10_linux or it will just add "rootflags=subvol=${rootsubvol}" every time you run grub-mkconfig.

Personally, I don't think automated rollbacks are worth all that trouble. It's easy enough to manually rename "@" to "@.old", make a read-write snapshot called "@", and reboot.

The layout you currently have is probably close to "best practice". But if you come up with a scheme you like better, then that is the best practice for you.

Offline

#3 2021-06-18 12:05:21

VVishion
Member
Registered: 2021-06-15
Posts: 9

Re: Best practise btrfs default subvolume

Thanks!
I'll read a bit about snapper rollback, but I do not think automated rollback is worth running into other problems, when rollback is not something I need to be automated.
Are there other essential/good tools I may consider taking a look at, before I settle with one specific layout or configuration?

Last edited by VVishion (2021-06-18 12:05:52)

Offline

#4 2021-06-19 10:07:30

willemw
Member
Registered: 2013-02-19
Posts: 113

Re: Best practise btrfs default subvolume

You could look into a Btrfs specific backup solution. If your filesystem becomes corrupt, then there is nothing to rollback from.
                                                                                                                                                                               
I use btrbk for both snapshots and replication/backups. It is layout independent. I use a layout that is different from the snapper layout (no '@' and the root subvolume is called 'root'), so it will never interfere with snapper.

Last edited by willemw (2021-06-19 10:11:00)

Offline

Board footer

Powered by FluxBB