How to unchain inodes on NixOS, while getting rid of orphaned packages [Introduction]

12 Jul 2025

Employ your garbage collector sustainably on NixOS.

#In case you're like me new to NixOS...

...you may not have noticed that it is obligatory to declare certain lines for automatic storage clean ups in your configuration.nix. Otherwise, you might end up in the worst-case scenario with not a single free inode left to link.

I use btrfs and had already completed 120 builds when my system crashed during the 121st build process, displaying an error like "no space left on device," even though I had a few hundred unused gigabytes available.

It turned out that hundreds of thousands of files and system links had been created over time, which consumed all of my inodes. I assume that old links were not deallocated and that nixos preserved a totally useless software package release history on my disk. At that point, it became impossible to rebuild nixos.

❌ Result: You can't simply comment out something in the configuration.nix nor initiate garbage collection rules there, because it's too late. You can't fix this via the configuration.nix file at all.

#Continue with

├──[ 1. checking partition stats ]
╰──[ 2. running garbage-collector ]


/sw-load.js?v=e5ae5a1ed170f4499ac6292e7164b68528c51f6d6518cd75a49e6a6b737831d5728da21fc14dcbc7a91328e53858c6ff7195cc3fc8b25f0feeaef2af151d6686 /favicon.ico?v=1a6495bbd14c74c75aa77e28420ce82a63372b28cd38c952b98403d8d112a9f76589bea299982ca27048215e661245f9d07294bddee7da377aaee76eee70c622 /favicon-16x16.png?v=7267c6f502a03c1e4df9d8136dcc6cd9e67e0b9644941d22ed34e4fe747580f95a65f77a183bb967c1ec60eecd0c298b2670d89a67a647391fb7d1501bcf0982 /favicon-32x32.png?v=5e23bffe691055b88067cbc8d11b96ce2a8dc5e25e49367803766a3cadbcfc7f05a62079bfa558d5e234c6a7455d21fc2960b196bda5cbd591bd4c2dbe67920d /icon-192x192.png?v=3820c1b1e6d755d2b7c2a04a65f0f1feef793b297f7ee995947137ccd8f73ec304457f6ce1df987a9a0a13ed7dacd203225505b832ccd2318b530ae53a55cebc /icon-512x512.png?v=de62ae905479fd813300d286ed1d2fe6bb6f6292623a5d918691642f6dd09a68943c69ed2a95a1820076919e69ff4fda668bb79e610ebc1d3200fedd7f634443 /apple-touch-icon.png?v=4718a090c66653794b3622234784e821a504ee526b6518f20cd10f6b27907566690892339830ede2ef9cb5fedb8a9796f02fb2610de868500c0720c1083013b7 /main.css?v=004c58ab886fb872b276d43218b4188bf5dd2e5e9dbcc1849778324fbe99e60204eea8a5bfae547422b828e615d24407f9da983c1622ac15645e5410b6c83f34 /unstyle.css?v=b14bd48a2efbd463d973763aa3184c69aa02164c0891acacc9eab49ddd275f98f0050b4c31d2093e4671e7abe04f9459a041f0064384a90d97b8ff21b6824825 /langs.css?v=12474958ee314a9fde4704e1f5a032dc632d41f9461faca326ac284297766c4ceb07b45fec7fbc09fa72b0f21dcc64f0c31e64fc2e5e838b1d30f5fe540afd78 /syntax-theme-light.css?v=f6e6c807eb281d55fa88e55276dabcb0d1a72cfa54b432cee2179497d8465a644ad979aaa77323042209cc25179d80f39240e90a0550561dcbca29935cd142ee /syntax-theme-dark.css?v=e7859e08ffe883f85615392635c02b6107cb37848513de49edd3e077eac6509fc782692e34d3fe1de6d3b87bdf8abe24a0e93cead1ac875f03282147cbbe3c27 /sw-style.css?v=a0fa1e87fa2bb3e03d18cefc81ef5c8cfa58c6aa6eea0af223fa155e088bc5af22d32d3ee785ebd3fc26b4c49b70f0bd423f7d592a419a24e6d1e2cb720b7e05 /categories/ /categories/DIY/ /categories/about/ /categories/ideas/ /tags/ /tags/Filesystems/ /tags/Linux/ /tags/NixOS/ /tags/Notebooks/ /tags/content/ /tags/me/ /posts/under_construction/ /diy/ /uebermich/ /posts/ c1tyh4ll.png?v=e6bb8cdead47e48c0deba1e0a3016070984b5f7271166a72638f9ec5a6ef2d2eb8012e8e4cb64f4f3b6574c6d708bf2ae660d04b8b59a6de675ce4d4d62dd4c3 obsidian.png?v=426621284f6d97ca988b7d614555d92b304cc0a3bb55b57f926789eacdbe6bc16e927109d01d634ec23952fb794982d0dfb11603df649ae0a586d2fc982c89aa ffmultra.gif?v=2d5031e4ef808634de742e2338a913cddab4c122d16490791dbf7364b2a659237d65d85c5eb56e08f3185332ec0f4b01af5e94376db4a1a81d5378103aa6bfcc /icon-192x192.png?v=3820c1b1e6d755d2b7c2a04a65f0f1feef793b297f7ee995947137ccd8f73ec304457f6ce1df987a9a0a13ed7dacd203225505b832ccd2318b530ae53a55cebc /glitch.css?v=0b9b7f8691385df5b832251e9cf4c56d68cbcfc98c6e4c27e015f6fb29d2f0c18c358c98c0e7e0a1da9f263d6b355b811e49aac099b70889090912a5040f754a /sitemap.xml /search_index.en.json /search.js /elasticlunr.min.js?v=b9be63b71422cbfde9f14310b397d9a7092f2946bffec11811a831398ace978c1c592e9a578f1fa32041e6c0dde68657fe58d3c30b0eaa758c63c5fd45117336">