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.
What maintenance for BTRFS is recommended, and does it work for subvolumes only?
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?)
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.
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
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.