Your cart is currently empty!
How To Fix Spotify Cache Bloat Using Tmpfs (RAM) On Debian And Ubuntu Linux
Spotify is great, but its Linux client has a nasty habit: it lets its cache grow endlessly. Before long, you’ll find several gigabytes of album art, audio chunks, and metadata clogging your ~/.cache/spotify directory.
If you’re running a system with limited storage — especially on SSDs — that bloat isn’t just annoying, it’s wasteful. The fix? Redirect Spotify’s cache to tmpfs, a RAM-based filesystem that wipes itself clean on reboot. It’s fast, temporary, and keeps your disk tidy.
Here’s how to do it.
1. Check Your Spotify Cache Size
Open a terminal and run:
du -sh ~/.cache/spotifyYou might be surprised at how big it’s gotten. Anything over a few hundred megabytes is unnecessary.
2. Create a RAM-Based Cache Directory
We’ll use tmpfs to hold Spotify’s cache in RAM. This keeps your disk clean and speeds up access at the cost of using a bit of memory while Spotify is running.
Create a new directory for it:
sudo mkdir -p /mnt/spotify-cacheThen mount it as a tmpfs filesystem:
sudo mount -t tmpfs -o size=256M tmpfs /mnt/spotify-cache💡 Adjust the
size=value as you like.
256M is usually plenty — it stores cached song fragments temporarily but won’t eat all your RAM.
3. Redirect Spotify’s Cache to the RAM Mount
You can either symlink Spotify’s cache directory or use Spotify’s internal environment variable. Let’s go with a symlink for simplicity.
rm -rf ~/.cache/spotify
ln -s /mnt/spotify-cache ~/.cache/spotifyThis tells Spotify to use your RAM-mounted folder for caching instead of your home directory.
4. Make It Persistent Across Reboots
By default, tmpfs mounts vanish after reboot. To make it automatic, edit /etc/fstab:
sudo nano /etc/fstabAdd this line at the end:
tmpfs /mnt/spotify-cache tmpfs size=256M,mode=1777 0 0Save and close the file. Next time you reboot, the cache folder will be mounted automatically.
5. (Optional) Create a Systemd Mount Unit
If you prefer the systemd way, create a mount unit instead of editing /etc/fstab.
sudo nano /etc/systemd/system/mnt-spotify\x2dcache.mountPaste this:
[Unit]
Description=RAM cache for Spotify
[Mount]
What=tmpfs
Where=/mnt/spotify-cache
Type=tmpfs
Options=size=256M,mode=1777
[Install]
WantedBy=multi-user.targetThen enable and start it:
sudo systemctl enable --now mnt-spotify\\x2dcache.mount6. Restart Spotify and Verify
Launch Spotify, play a song or two, then check the mount:
df -h | grep spotifyYou should see your tmpfs mounted and Spotify’s cache appearing inside it.
7. Bonus: Limit Disk Cache in Spotify
Spotify doesn’t officially expose cache size settings on Linux, but if you run it under Flatpak, you can clear its cache easily:
flatpak run --command=sh com.spotify.Client
rm -rf ~/.var/app/com.spotify.Client/cache/spotifyStill, using tmpfs is the cleaner, automatic fix.
Why This Works
- Faster access: RAM is much faster than disk.
- Auto-cleans: The cache disappears every reboot — no need to purge manually.
- Saves SSD writes: No unnecessary wear from constant cache churn.
Spotify will still work exactly as before — you just won’t be left with gigabytes of stale data.
Final Thoughts
Spotify’s cache bloat is a long-standing quirk of the Linux client. Using tmpfs to store that cache in RAM is a simple, elegant workaround that improves performance and keeps your drive clean.
Once you set it up, you’ll never have to worry about Spotify eating your disk space again.

Tech enthusiast and content creator passionate about making technology simple for everyone. I share practical tips, guides, and reviews on the latest in computers, software, and gadgets. Let’s explore the digital world together!
