protonscr

BTRFS compression does not affect game installs unless defragmented

steamopen
ValveSoftware/steam-for-linux#12974 · opened 2026-03-12 by brianclinkenbeard · updated 2026-04-08 · 1 comments · github
Bbrianclinkenbeard 2026-03-12 github

Your system information

  • Steam client version (build number or date): 1773099986
  • Distribution (e.g. Ubuntu): Fedora / Flatpak
  • Opted into Steam client beta?: No
  • Have you checked for system updates?: Yes
  • Steam Logs: N/A
  • GPU: N/A

Please describe your issue in as much detail as possible:

When using compress=zstd (BTRFS default, at least on Fedora 43), games are not properly compressed. I believe this is due to Steam's use of fallocate for game installs. If we check something like Baldur's Gate 3 with compsize, the game will initially be almost entirely uncompressed (looks like only some post-install files are picked up). After running btrfs defragment -r -v -czstd on the folder, compression kicks in for 14GB of savings:

$ sudo compsize steamapps/common/Baldurs\ Gate\ 3 # After defragmentation
Processed 365 files, 863716 regular extents (863716 refs), 17 inline, 313216 fragments.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       90%      130G         144G         144G
none       100%       52G          52G          52G
zstd        84%       78G          92G          92G

Steps for reproducing this issue:

  1. Use btrfs mounted with compress=zstd (any compression level)
  2. Install a game
  3. Run sudo compsize on game directory
  4. Note no noticeable compression of files upon install

To verify:

  1. Run btrfs defragment -r -v -czstd -L [compression level for mount] path/to/game
  2. Note massive increase in percentage of compressed files
DDarkstring6 2026-04-08 github

I believe im also seeing this behavior
CachyOS (up to date)
Steam multilib package
Steam client: 1775525170

Defragmented my steam library about a month ago after belatedly enabling zstd compression on a game drive. (70-75% compression)
Recently checking the compsize had about an 80-85% ratio, after rerunning defragment it returns to an expected size.

Don't have the numbers for those so I did a small test to verify my sanity with a brand new install

❯ sudo compsize /run/media/Steamy/SteamLibrary/steamapps/common/Slime*Rancher # Before
Processed 591 files, 4888 regular extents (4888 refs), 56 inline.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       75%      901M         1.1G         1.1G
none       100%      735M         735M         734M
zstd        36%      166M         455M         455M

❯ sudo btrfs filesystem defragment -r -v -czstd -L 1 /run/media/Steamy/SteamLibrary/steamapps/common/Slime*Rancher

❯ sudo compsize /run/media/Steamy/SteamLibrary/steamapps/common/Slime*Rancher # After
Processed 591 files, 8618 regular extents (8618 refs), 56 inline.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       56%      673M         1.1G         1.1G
none       100%      223M         223M         223M
zstd        46%      449M         965M         965M

Nothing extracted yet.