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

12 Jul 2025

1. Checking inode consumption on different parition types

├──[ 0. main article ]
╰──[ 2. performing storage clean ups]

A Examining disk usage and inode consumption statistics on btrfs, ext4 and xfs

What are Inodes? An Inode is an abbreavation for index node. Index nodes are memory units that store metadata, such as the memory sectors where a certain file is actually stored and the file attributes.

To put an emphasize on slightly differences between some random filesystem types i was able to examine.

[🧩] A.1 Check Disk Usage

Let us begin with printing the disk usage with the df tool out, to rule this out.

df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1,6G     0  1,6G   0% /dev
tmpfs            16G   63M   16G   1% /dev/shm
tmpfs           7,7G  7,1M  7,7G   1% /run
/dev/dm-1       457G  266G  185G  60% /
efivarfs        128K   41K   83K  33% /sys/firmware/efi/efivars
tmpfs           1,0M     0  1,0M   0% /run/credentials/systemd-journald.service
tmpfs           1,0M     0  1,0M   0% /run/credentials/systemd-tmpfiles-setup-dev-early.service
tmpfs           1,0M     0  1,0M   0% /run/credentials/systemd-tmpfiles-setup-dev.service
tmpfs            16G  2,0M   16G   1% /run/wrappers
tmpfs           1,0M     0  1,0M   0% /run/credentials/systemd-vconsole-setup.service
/dev/nvme0n1p3  4,3G   87M  4,2G   2% /boot
tmpfs           1,0M     0  1,0M   0% /run/credentials/systemd-tmpfiles-setup.service
/dev/sda4       458G  351G   84G  81% /mnt/ssd
/dev/sdb3       873G  733G   96G  89% /mnt/hdd
tmpfs           1,0M     0  1,0M   0% /run/credentials/systemd-sysctl.service
tmpfs           3,1G  200K  3,1G   1% /run/user/1000

✅ 40% of system root directory are free and theres also no sub-partition mounted in root besides boot and tempfs. Therefore the "no space left" error was not caused by a lack of overall disk space.


If you simply don't have disk space left, because you have also forgotten to declare garbage collection cycles, you could do this now manually by continuing from here. Otherwise wipe some gigabites and consider to extend your partition.



B Checking out the inode consumption with df -i

[🧩] B.1 Optional: btrfs (won't work)

df -i
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
devtmpfs        3987643    837  3986806    1% /dev
tmpfs           3990104    389  3989715    1% /dev/shm
tmpfs           3990104   2756  3987348    1% /run
/dev/dm-1             0      0        0     - /
efivarfs              0      0        0     - /sys/firmware/efi/efivars
tmpfs              1024      1     1023    1% /run/credentials/systemd-journald.service
tmpfs              1024      1     1023    1% /run/credentials/systemd-tmpfiles-setup-dev-early.service
tmpfs              1024      1     1023    1% /run/credentials/systemd-tmpfiles-setup-dev.service
tmpfs           3990104     33  3990071    1% /run/wrappers
tmpfs              1024      1     1023    1% /run/credentials/systemd-vconsole-setup.service
/dev/nvme0n1p3        0      0        0     - /boot
tmpfs              1024      1     1023    1% /run/credentials/systemd-tmpfiles-setup.service
/dev/sda4      30531584  15188 30516396    1% /mnt/ssd
/dev/sdb3      58097664 760335 57337329    2% /mnt/hdd
tmpfs              1024      1     1023    1% /run/credentials/systemd-sysctl.service
tmpfs            798020    278   797742    1% /run/user/1000
tmpfs              1024      1     1023    1% /run/credentials/getty@tty2.service

❌ df -i can't read the inode consumption of my btrfs root partition, resulting in an output of 0/0/0/-.

C Choosing the correct inode measurement tool depending on the filesystem format

As demonstrated right above, every partition format uses its own technique to preserve or balance a contingent of inodes. Inodes are responsible for storing file-related metadata, like systemlinks, timestamps, ownership, access rights and so on.

[🧩] C.1 Optional: btrfs

sudo btrfs filesystem usage /
Overall:
Device size:         456.52GiB
Device allocated:    456.52GiB
Device unallocated:    1.01MiB
Device missing:        0.00B
Device slack:          1.50KiB
Used:                265.34GiB
Free (estimated):    184.69GiB	(min: 184.69GiB)
Free (statfs, df):   184.69GiB
Data ratio:            1.00
Metadata ratio:        2.00
Global reserve:      475.66MiB	(used: 0.00B)
Multiple profiles:		  no

Data,single: Size:440.50GiB, Used:255.81GiB (58.07%)
/dev/mapper/luks-4b890b26-f927-468e-9ce2-ead3d942224f	 440.50GiB

Metadata,DUP: Size:8.00GiB, Used:4.76GiB (59.56%)
/dev/mapper/luks-4b890b26-f927-468e-9ce2-ead3d942224f	  16.00GiB

System,DUP: Size:8.00MiB, Used:64.00KiB (0.78%)
/dev/mapper/luks-4b890b26-f927-468e-9ce2-ead3d942224f	  16.00MiB

✅ Actually i must have enough space for inode allocation left. On this btrfs partition, only 59.46% of the preserved space for Metadata/DUP was consumed. This is no surprise, because i already have fixed this. But if you actually don't have any space left, please continue here to call the garbage collector and consider also to perform a btrfs scrub.

Let's focus on this part of the previous output:

Metadata,DUP: Size:8.00GiB, Used:4.76GiB (59.56%)
/dev/mapper/luks-4b890b26-f927-468e-9ce2-ead3d942224f	  16.00GiB

The reserved space for metadata equals 16.00GiB of total disk space but de-facto only 8.00GiB are allocatable for metadata or inodes. These 8.00GiB are mirrored to maximize file consistency. There should always be a backup, just in case. I guess DUP simply means duplicate.

[🧩] C.2 Optional: ext4

My root partition on my Fedora system is formatted with ext4. I'm providing df -i for a comparison:

df -i
Filesystem       Inodes  IUsed    IFree   IUse% Mounted on
/dev/dm-0       6291456  1145703  5145753   19% /
devtmpfs        4340946      762  4340184    1% /dev
tmpfs           4349497        5  4349492    1% /dev/shm
efivarfs              0        0        0     - /sys/firmware/efi/efivars
tmpfs            819200     1561   817639    1% /run
tmpfs              1024        1     1023    1% /run/credentials/systemd-cryptsetup@luks\x2d36ad2af2\x2d58af\x2d583e\x2d827a\x2d47ae94d8f3db.service
tmpfs              1024        2     1022    1% /run/credentials/systemd-journald.service
/dev/nvme0n1p7   137632      107   137525    1% /boot
tmpfs           1048576       67  1048509    1% /tmp
/dev/nvme0n1p8        0        0        0     - /boot/efi
tmpfs              1024        2     1022    1% /run/credentials/systemd-resolved.service
tmpfs            869899      697   869202    1% /run/user/1000
tmpfs              1024        2     1022    1% /run/credentials/getty@tty3.service

df -i is able to read and process inode statistics of ext4 partitions

[🧩] C.3 Optional: xfs

Also for comparison reasons i called for df -i statistics from my MX Linux machine with a xfs formated root partition.

df -i
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
udev             116689    439   116250    1% /dev
tmpfs            126496    645   125851    1% /run
/dev/dm-0      14343680 417977 13925703    3% /
tmpfs            126496      3   126493    1% /run/lock
tmpfs            126496      4   126492    1% /dev/shm
/dev/sda1             0      0        0     - /boot
cgroup           126496      4   126492    1% /sys/fs/cgroup
tmpfs            126496     36   126460    1% /run/user/1000

df -i is also able to read and process inode statistics of xfs partitions

D Comparison of btrfs, ext4 and xfs

Depending on your partition type you must find the correct tool to gather the wanted information about actual inode consumption.
E.g. for btrfs i would go for the btrfs usage tool and then check the metadata paragraph.

For at least ext4 and xfs filesystems will df -i do the trick

╰──[ next ]


/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">