Storage optimization: Difference between revisions
imported>Mth m bash syntax highlighting makes root prompts look like comments |
imported>Mth mNo edit summary |
||
Line 1: | Line 1: | ||
A recurring problem with NixOS is lack of space on <code>/</code>. Even if you are using Nix only occasionally, it is easy for <code>/nix/store</code> to go beyond | A recurring problem with NixOS is lack of space on <code>/</code>. Even if you are using Nix only occasionally, it is easy for <code>/nix/store</code> to go beyond 50GiB. Here are generic notes on how to not run out of space too often. | ||
== Garbage collection == | == Garbage collection == | ||
Line 38: | Line 38: | ||
=== Look for <code>result</code> symlinks === | === Look for <code>result</code> symlinks === | ||
If you use <code>nix-build</code>, but | If you use <code>nix-build</code>, but not <code>--no-build-output</code>, your FS will be filled with <code>result</code> symlinks to various derivations. In the example above, note the following symlinks: | ||
<syntaxhighlight lang="bash">/home/danbst/stack/new/website/server/result -> /nix/store/1jhmp6vl364p32r8bjigk65qh1xa562f-server-0.1.0.0 | <syntaxhighlight lang="bash">/home/danbst/stack/new/website/server/result -> /nix/store/1jhmp6vl364p32r8bjigk65qh1xa562f-server-0.1.0.0 | ||
/home/ec2-user/result -> /nix/store/q35aq2sh5dbyka6g6f6qb7b8msxwds5m-nixos-system-iron-16.03.1299.a8e0739 | /home/ec2-user/result -> /nix/store/q35aq2sh5dbyka6g6f6qb7b8msxwds5m-nixos-system-iron-16.03.1299.a8e0739 | ||
Line 55: | Line 55: | ||
690 store paths deleted, 1817.99 MiB freed | 690 store paths deleted, 1817.99 MiB freed | ||
</pre> | </pre> | ||
Look for system derivations in particular. Those are created on many occasions, for example when running <code>nixos-rebuild build-vm</code> | |||
=== Reboot === | === Reboot === |