Running out of disk space on Ubuntu? Before you start uninstalling applications or clearing caches, you might want to check your snap revisions.
I’ve been getting low disk space warnings on a 40GB Ubuntu partition1. The usual tips to free space on Ubuntu weren’t enough, so I opened Disk Usage Analyser – or run sudo du -sh /var/lib/snapd – and found nearly 8GB was eaten up by old snap versions.
Not active versions of Snaps I have installed; backups of every snap I have installed. There, idle, in the snapd folder consuming several gigabytes “just in case” I need to rollback (in all the times I’ve used snaps, I’ve never done).
Don’t get me wrong: the default approach is not is a bad thing at all.
Why Snap Revisions Exist (and why to keep them)
Why not use a script?
You’ll find bash scripts online that remove all disabled snap revisions automatically. They work, but nuke every backup.
If you’re comfortable with that approach then go for it.
But if you’d rather see what you’re removing (especially if critical snaps like kernels or drivers), a manual approach leaves you in control.
Snapd keeps two versions of all snaps (app, core, runtime and drivers) around. You can’t disable it; the snap refresh.retain setting bottoms out at two.
It means you always have one backup of everything (if it’s been updated since you installed it, otherwise there’s nothing to backup).
This is a good thing.
Snaps update silently in the background. If a new version is installed that has issues you can rollback to the previous version – for snaps that update frequently, you’ll appreciate being able to do this should you need to.
In industrial, IoT and edge computing, where snaps are widely used, this rollback capability is part of the intrinsic appeal (they can be triggered remotely).
On my cramped laptop partition, 8GB of “worst-case” insurance feels a bit… Eh2.
Which is the reason I am writing this tutorial, to show how to clean up snap revisions when you’re running out of space on Ubuntu. One could make a script to automate this, but over-engineering less control feels… Well, eh3.
Checking What’s Taking Up Space
To see a list of all snaps and available revisions on your device, run this in your terminal:
sudo snap list --all
This shows everything installed: apps, cores/runtimes and drivers, along with revision numbers and whether they are active or disabled snap packages. The number in the revision column is key here, so make sure you can spot it.
There is no GUI equivalent of this command. Ubuntu’s App Center (the graphical way to manage your install Snaps) does not have a mechanism for managing revisions/backups.
One thing the snap list command won’t show you is is size, i.e. how much room the active and disable snaps consume.
To check total snapd usage run sudo du -sh /var/lib/snapd or, for individual snap sizes, I prefer to open the Disk Usage Analyser and navigate to /var/lib/snapd/snaps as this also shows dates, which gives you an idea of how old the disabled version is.
If you haven’t experienced issues with the active build, you can more confidently delete the disabled version – though only if you need to, of course.
Removing Disabled Snap Revisions
Head back to your terminal and run the following command, but replace the revision number and the snap-name with the corresponding one from the snap list --all command:
sudo snap remove --revision=0000 snap-name
Check you have entered the correct version before you hit enter as there is no “are you sure you want to proceed” check.
I find it helpful to use two terminal windows, highlighting the line in the list to focus my eyes (like a 7 year old learning to read with a ruler).
Rinse and repeat for all the disabled snaps. This will remove old snap versions and free up disk space.
This is not a permanent fix
One drawback (I use the term loosely) is that this is not a permanent fix. As installed snaps update, old versions are retained and you’ll eventually need to do repeat this again.
But if you’re genuinely constrained for space, and intent on using snaps, this periodic effort is worth it, however temporary it may be. On systems with lots of snaps, don’t be surprised (as I was) to find your snapd folder using gigabytes.
Helpful? Let me know in the comments.
- Yes, that is small, but it’s one of 4 partitions on a 256GB SSD on my testing laptop. I like to keep my personal install on my main device free of potential issues so I can, y’know, use it. ↩︎
- Apologies to the reader who complained the last time I used eh instead of real words. ↩︎
- Dammit; sorry again. ↩︎

