Re: Btrfs best practices: defrag?

2022-01-27 Thread Andy Smith
Hello,

On Wed, Jan 26, 2022 at 08:38:41PM +, piorunz wrote:
> My current fstab mounting:
> 
> noatime,space_cache=v2,compress-force=zstd:3 0 2
> 
> Will autodefrag break COW files? Like I copy paste a file and I save
> space, but defrag with destroy this space saving?

Yes, I believe so. That is, if you have files sharing extents (like
if you de-duplicated them or did a "cp --reflink=always") and defrag
touches those files, it will undo the extent sharing.

> Also, will autodefrag compress files automatically, as mount option
> enforces (compress-force=zstd:3)?

Yes.

> Any suggestions welcome.

If you're not relying on extent sharing then I'd think that
automated defrag is okay.

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



Re: Btrfs best practices: defrag?

2022-01-26 Thread piorunz

I'd like to add question to this topic.

Is it safe & recommended to run autodefrag mount option in fstab?
I am considering two machines here, normal desktop which has Btrfs as
/home, and server with VM and other databases also btrfs /home. Both
Btrfs RAID10 types. Both are heavily fragmented. I never defragmented
them, in fact.

Running manual defrag on server machine, like:
sudo btrfs filesystem defrag -v -t4G -r /home
takes ages and can cause 120 second timeout kernel error in dmesg due to
service timeouts. I prefer to autodefrag gradually, overtime, mount
option seems to be good for that.

My current fstab mounting:

noatime,space_cache=v2,compress-force=zstd:3 0 2

Will autodefrag break COW files? Like I copy paste a file and I save
space, but defrag with destroy this space saving?
Also, will autodefrag compress files automatically, as mount option
enforces (compress-force=zstd:3)?

Any suggestions welcome.

--
With kindest regards, Piotr.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org/
⠈⠳⣄