Invisible files taking up space

I’m having an issue with my home server. The system drive is 120GB, but it’s slowly being filled up by something unknown. I’ve tried using df and du to find out what’s taking up all the space, but I haven’t had any luck. ncdu shows that the /nix directory is the largest, at just 12GB.

Here are some outputs that might help diagnose the issue:

/dev/sdb2      116719616 102833688  11091672  91% /nix
/dev/sdb2      116719616 102833688  11091672  91% /srv
/dev/sdb2      116719616 102833688  11091672  91% /home
   12.8 GiB S  56.4 MiB [########################] /nix                                                                                                                  
    7.0 GiB S  56.4 MiB [#############           ] /var
    2.4 GiB             [####                    ] /srv
    1.4 GiB             [##                      ] /home
   31.9 MiB             [                        ] /boot
    6.2 MiB             [                        ] /root
    6.0 MiB             [                        ] /run
  184.0 KiB             [                        ] /tmp
  168.0 KiB             [                        ] /dev
   96.0 KiB             [                        ] /config
   72.0 KiB             [                        ] /etc
    0.0   B             [                        ] /usr
    0.0   B             [                        ] /lib
    0.0   B             [                        ] /bin
    0.0   B             [                        ] /lib64
^   0.0   B             [                        ] /sys
^   0.0   B             [                        ] /proc

I’ve also shared my configuration here: dots/hosts/ikaros at master · ilovethensa/dots · GitHub.

Could someone help me figure out what’s filling up my drive and how to fix it?

I think I noticed the same situation

  • in my case folders with big data files were included in the package source and each build process made the disk space disappearing

nixos_disk_I
nixos_disk_files

nix-tree can help find what’s taking up the most space in derivations. Try pointing it at your system profile:

$ nix-tree --derivation /nix/var/nix/profiles/system

If you’ve been installing anything in the user profile(s), you’ll also want to run that on those.

Since your machine’s storage is fairly small, you will want to clean up old generations fairly often with nix-collect-garbage.

Im running sudo nix-collect-garbage -d and sudo nix-store --gc is that not enough?

More than enough, I think.

well that remove a few gigabytes but still over 90% usage