I recently stumbled upon the usual issue with all my development machines: “no space left on device”.
As it happens frequently, I had to spin up the trusted disk analyser, Baobab and dig into it.
Something was filling up my 512GB disk, but exactly what?
Well, that wasn’t that suprising, but:
- My Trash was
- I used asdf to manage programming language interpreter/runtimes, this was taking
~30GB, 24 of them being taken by Golang installations and relative packages
codefolder, where I keep all code I’ve been hacking/working on, was
It replaces Homebrew, that I loved but has it’s drawbacks on Linux: compiling things was a total nightmare, and it happened quite a lot.
I was also extremely intrigued by the declarative approach Nix that promises reproducible configurations, something I’m trying to achieve to reduce surprises (works on my computer means work on remote server, this is a dream for a SysAdmin).
In the end I had 99GB in
To clean them up I discovered I needed to run GC and optimise the
$ nix-store --gc
$ nix-store --optimise
$ nix-collect-garbage -d
These commands combined cleaned up around
50GB of disk space 😎
The next step were snaps, where
~7GB where used.
2 steps here:
- reduced the number of retained versions to 2 (default is 3)
- cleanup all disabled snaps
I followed instructions on this article, with the addition of using this command to check for active services:
$ snap info "$snapname" | grep -w active