Do any KDE applications support managing FS compression?

For instance, can I use dolphin or partitionmanager to manage filesystem compression like Windows’s Explorer and Overview of Disk Management | Microsoft Learn MSC module can? I use solely BTRFS.

I answered conversion - Can Files Be Compressed Without Changing Extension? - Super User today, and have been bothered since with the apparent lack of GUI tools to manage filesystem compression, not least because it has prevented me utilizing it.

No, however you can enable transparent compression at the file system level if you are using btrfs or zfs for example.

For btrfs it can be done through the compress=zstd flag in the mounting command or in fstab or writing it in a GUI that allows you to manage mount options, like Gnome Disks or Partition Manager, but you have to type it. For zfs it can be done through the CLI too, using the zfs set compress=zstd command.

Both file systems will start compressing new stuff after the file system is remounted (just reboot). In order for btrfs to compress old stuff, you would need to run defrag, I believe that zfs can’t compress stuff that was already on disk so you would need to move it out and back in again.

1 Like

@eridani, where in partitionmanager, specifically? I don’t mind writing flags, I just don’t want to have to learn filesystem-specific command syntax for the CLI.

Does dolphin provide a visual aide like Explorer does (Explorer uses blue name fields and an icon overlay to indicate compression) to demonstrate what has been compressed? Obviously eventually all of it shall, but being able to easily track its progress is useful.

  1. Check the integrity of your backup. This is a safe process, but you can always click the wrong button. And read everything once before starting.
  2. In Partition manager Right click on your btrfs partition
  3. Edit mount point
  4. Under Options click the “More…” button
  5. And type the file system options, comma separated.
  6. But honestly, just learn to use /etc/fstab, is a text file, plain and simple.

What this method does is adding an entry to /etc/fstab for you; however, if your partition already has an entry in fstab, it will replace such entry, so in that case it would have been much cleaner to just open fstab in Kate or whatever text editor and append the compress=zstd flag to that entry, Ctrl+S and reboot.

Dolphin does not provide any hint about file system compression.

If you want your whole volume compressed, I would recommend to set the flag and then simply run btrfs fi defrag -v -r -czstd /your/mount/point in a terminal and get done with it. Change zstd for whatever supported compression algorithm you want. In that command, fi stands for filesystem, -v stands for verbose, -r for recursive, and -c for compress.

Take notice that with btrfs, after you set the compress flag, as I’ve already said, only new data will be compressed, unless the volume was mounted with the autodefrag flag (check your fstab file to see what options are in use, unless we are talking about a removable device of course, external devices usually doesn’t have an fstab entry). This is the reason I recommend the command above, it will defrag everything in the volume while compressing it, so you won’t need to wait and see if the autodefrag already worked on X or Y file or haven’t yet.

If you had a btrfs file system, and you add both compress,autodefrag options and reboot, theoretically, any existing data will be compressed the next time it is defraged, however, if the disk isn’t fragmented (which is very likely) it won’t be defraged thus it won’t get compressed. Ergo, defrag manually, and get it over with.

1 Like

Do any KDE applications support managing FS compression? - #4 by eridani

@eridani, as you correctly advise me to create backups, I can’t yet evaluate this (I’ve a TiB to duplicate) but I am seriously thankful for the advice.