BTRFS-management on Fedora Atomic

Fedora Atomic desktops use BTRFS and probably use its benefits

  • deduplicating OSTree snapshots
  • compressing storage to increase SSD lifespan

but they also do a lot of complicated linking, and everything outside /var is read-only. There are so many sym-/ hardlinks and BTRFS subvolumes that I am confused.

  1. What maintenance for BTRFS is recommended, and does it work for subvolumes only?
  2. Is it dangerous to run these maintenance tasks on the immutable system partitions?

So it seems the btrfs actions on the whole filesystem work, even though the files themselves may be immutable. (I dont understand that?)


What works:

sudo btrfs scrub start /

Seems to work but errors out after a while:

 sudo btrfs balance start / --full-balance
1 Like

Are they failing because the filesystem is immutable?

Many of the maintenance-related commands run on the entire filesystem even you target a specific subvolume/mountpoint.

Yes running balance on the entire filesystem errors out.

No, many commands are also possible for just a subvolume. But as most are links (symlinks or hardlinks?) For example in /ostree/deploy/... I wonder what is the correct subvolume to run the commands on.

As it relates to filesystem maintenance, what can you do to just a subvolume?

True, many things may only be available for the whole filesystem.

So again, is immutable Fedora on BTRFS an issue over time? If you cannot defragment, balance etc, will the partitions get messed up over time?

I just installed kinoite to see what was going on and it was possible to run those operations for me.

Since they run on the whole filesystem, you can just choose a target mountpoint that is rw.

1 Like

Please report what you tried and the errors you got because this should work just fine on Atomic Desktops.

1 Like

For me, it depends which mountpoint you try to run it on. You need to pick one that is r/w.

$ sudo btrfs balance start /sysroot --full-balance
ERROR: error during balancing '/sysroot': Read-only file system
There may be more info in syslog - try dmesg | tail

$ sudo btrfs balance start / --full-balance
Done, had to relocate 11 out of 11 chunks
3 Likes

Yes same here. It works and looks logical (even though /sysroot is “the real system root” whatever this means here)

Can confirm that running balance and pointing to / does let the command run which is good. It does feel like a bit of an oversight that there isn’t any form of automatic btrfs maintenance scripts or functionality baked into Fedora Atomic because I feel like isn’t that just going to result in the system falling over and breaking eventually? I’d have thought these operations would have been pretty integral to overall system functionality overtime but please do correct me if I’m wrong

Nothing. It’s just a files b-tree, not an isolated file system. For the most part a subvolume can be considered a special kind of directory that you can snapshot.

Typical operations should not require maintenance. It is possible to layer RPM packages on rpm-ostree based installations, including the btrfsmaintenance package, then enabling btrfs-balance.timer

I personally never use the maintenance scripts and have also never run into a problem. I’d consider a problem happening without btrfsmaintenance enable to be a quasi-bug. Some of these are known and are being fixed as they’re discovered. Some are simple fixes some are long term fixes.

If you’re OK helping to troubleshoot such bugs you can leave btrfsmaintenance uninstalled. If you don’t like the idea of helping to troubleshoot, that’s OK, just install btrfsmaintenance and enable the balance timer.