💡 Info: This article is for the GNU/Linux operative system, It might work on SteamOS, but I haven’t tried since I do not own that device. This also assumes you have intermediate knowledge using the command line.
Disclaimer: Please do back-ups before playing around your files and folders. I don’t want you to lose your precious save files. Also disable Steam cloud until you check that everything works fine. I am not responsible for any file loss.
Playing games using Steam on GNU/Linux with Proton is great, but there is a small detail,
Wine needs to create a folder called prefix that contains a bunch of libraries and usually emulates the Drive C:/
found on the Windows operative system.
Steam creates a new prefix folder for each game that you have installed, this means it could take a lot of drive space that we could take advantage of.
An experiment I am doing is to create a loop device and formatting as btrfs with compression to mount it into that directory, so it takes less drive space on the long run.
This solution only applies for users of traditional file systems (like ext4), if you already use btrfs, you probably don’t need this, only take in mind that enabling compression on that particular folder (compatdata) might help.
How to accomplish this
These commands are aimed at experienced users rather than novices, please double-check before copy-pasting!
Make sure to close Steam before this!
If you aren’t sure where your Steam Library is located, you can check by right-clicking on any game on Steam, going to Properties, the tab Local files, and clicking the button on the top right that says Browse.
Choose a size for the loop device, this depends on the number of games you have, every game takes from ~200MB to ~600MB at worst.
For calculating a size, I recommend multiplying the number of games you have (or think you will install, you can overestimate if you want) by 600M.
For example, I have 29 games, and I hope to install let’s say 40 games.
So this will be 40 * 600 = 24000M . Which is around 24GB.
Note: the compressed size for each folder will be smaller, so you can tune in this “600” number down if you want to experiment a bit.
Create a temporary folder to mount the filesystem
Mount the filesystem
For this you will need to choose a compression level for zstd, I am going with 5.
Take ownership of the root folder from the loop device
Copy all the prefixes to the loop device
Now we will rename the actual compatdata to have a backup (you can remove it later if it works!)
Create an empty folder to mount the loop-device in
Unmount the loop-device
Edit /etc/fstab
For this you can open your favorite editor, to be friendly here will show nano.
Add this at the end
Make sure to replace the folder paths correctly and use your compression level
Note: You can also use systemd mounts instead of fstab.
Mount all and reload systemd daemon
The results
Looking at the ext4 folder, for 29 games, there is around 8 GiB of files.
Checking current disk usage of the loop-device folder (thanks to Thunar, by right-clicking the compatdata), around 3.7 GiB used (15%).
I hope you find this information useful.
👋Take care