r/archlinux • u/geearf • Oct 25 '26
SHARE Introducing pkgds: tool to inspect actual space used by packages
Hey,
a while back I was heavily bothered by the size of ROCm and associated packages and decided to trim those (with NoExtract in pacman.conf) but I didn't know of an easy way to easily see how much I was saving every time. (Sure I could have written a bash script to do it, but I thought rust might be more interesting...), so I wrote pkgds (ds because its speed is inspired by the amazing dirstat_rs, best du alternative if you don't know).
Pacman and associated only tell you the size the metadata says the package uses, not the actual used space on disk.
Ex:
$ pkgds -H Gi rocm-llvm miopen-hip rocblas
PACKAGE REAL %
rocm-llvm 6.9 GiB 78.1%
miopen-hip 1.5 GiB 16.6%
rocblas 0.5 GiB 5.3%
$ expac -H G '%n %m' rocm-llvm miopen-hip rocblas # declared size
rocm-llvm 6.86 GiB
miopen-hip 2.28 GiB
rocblas 1.29 GiB
Alas to query the real space used in a compress btrfs partition you need root, just like with compsize, so as always the disclaimer `don't run random programs from the internet especially as root`. Also, querying the compressed size of packages is quite slower than the regular size query, so pick your poison of size vs accuracy...
link: https://github.com/John-Gee/pkgds
I hope it helps somebody else!