News for hackers. Stuff that matters.
Re:Scripts for Btrfs Maintenance by chasil on Tuesday June 06, 2023 @08:18PM (#36221004)
Why is nobody mentioning?:

  btrfs fi defrag -r /
This is a recovery that ZFS cannot make.

https://www.usenix.org/system/files/login/articles/login_sum...

Re:Scripts for Btrfs Maintenance by nubinetwork on Tuesday June 06, 2023 @08:54PM (#36221322)
ZFS doesn't need it, if the file is accessed enough, it stays in cache. If the file isn't important enough, who cares that it takes a little bit longer to load into memory?
Re:Scripts for Btrfs Maintenance by chasil on Tuesday June 06, 2023 @09:08PM (#36221444)
If a ZFS dataset goes over 80% utilization, I understand it will switch from "first fit" to "best fit" which can permanently and severely impact performance.

https://serverfault.com/questions/733817/does-the-max-80-use...

Re:Scripts for Btrfs Maintenance by LeoPanthera on Tuesday June 06, 2023 @09:55PM (#36221834)
I actually tested this, and could not measure any performance hit at all until I hit 95% full.

It sped right back up again when I deleted some stuff.

I wouldn't worry about it.

Re:Scripts for Btrfs Maintenance by chasil on Tuesday June 06, 2023 @10:39PM (#36222195)
Interesting test. Thanks for finding this out.
Re:Scripts for Btrfs Maintenance by seized on Tuesday June 06, 2023 @09:57PM (#36221858)
You can ZFS send back and forth between pools or to a new dataset to defrag/fix that, so it's not "permanent" as in can't ever be fixed. It also depends on workload, write once/read many is different from VM disk files.
Re:Scripts for Btrfs Maintenance by chasil on Tuesday June 06, 2023 @10:30PM (#36222127)
Btrfs can "rebalance" in place. This has had bugs in the past, but seems safe now.

On the side of ZFS, you can take one volume of a mirrorset, move it to another system and mount it in degraded mode, and copy a bunch of new files to it. When you return the updated drive to the full set and mount it, it will resilver the older drive with the newer content automatically.

That's a killer feature. With btrfs, you have to rebalance to mirror the new files, which takes a long time as every block must be rewritten between the mirrors. ZFS knows how to move just the new files in a resilver.

Re:Scripts for Btrfs Maintenance by foobarqux on Tuesday June 06, 2023 @09:03PM (#36221386)
Defrag breaks COW so if you use COW a lot (e.g. snapshots) you don't want to do it.
Re:Scripts for Btrfs Maintenance by fsckboy on Wednesday June 07, 2023 @04:18AM (#36224285)
what do you mean it breaks? does it purge* the older versions, or does something break?

* (yes, DEC reference)

Re:Scripts for Btrfs Maintenance by jraph on Wednesday June 07, 2023 @04:59AM (#36224516)
It deduplicates everything. Don't defrag Btrfs lightly, unless you have a specific issue to solve and you ran out off other solutions. Even then, only do it if you know what you are doing.
Re:Scripts for Btrfs Maintenance by the8472 on Wednesday June 07, 2023 @05:34AM (#36224748)
*reduplicates

Anyway, deduplication can be recovered after a defrag by running duperemove or similar tools. But it's a lot of added work so it's only really worth it if fragmentation is an issue in the first place.

Re:Scripts for Btrfs Maintenance by Dylan16807 on Thursday June 08, 2023 @03:31PM (#36247435)
And you have to cross your fingers and hope it picks the defragmented copy, as far as I know.

It's also very slow to go through that on multiple snapshots.

And I think some of the metadata doesn't like to recombine?