FYI Defrag EXT4, BTRFS

Due to some recent conversations I’ve had in both forum and other about online defragmenting file systems,

It seems the following are available on openSUSE…

EXT4 - e4defrag has existed in the existed in the e2fsprogs kernel module since 2012, which is apparently an updated version of the earlier e2defrag. Should automatically be available without any package installation, with MAN page.

BTRFS - There are many possible methods, some of the following is from the Arch Wiki BTRFS
https://wiki.archlinux.org/index.php/Btrfs

The following compresses and defrags files in the root partition

btrfs filesystem defragment -r -v -clzo /

BTRFS supports the mount option (can be added to your fstab) “autodefrag”

The following command defrags the root partition manually

btrfs filesystem defragment -r /

Although there is a “btrfs-defrag.py” utillty in the btrfsprogs package source (github), it doesn’t seem to be part of the current openSUSE package.

TSU

Note; You should never, ever, do these things on an SSD on a consumer system - even with modern systems where wear is no longer such an issue (and Optane where it’s even less).