Storage optimization: Difference between revisions
imported>Kiwi mNo edit summary |
imported>Artturin move optimizing the store up so that it is more visible and add automatically section |
||
| 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 50GiB. Here are generic notes on how to not run out of space too often. | 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. | ||
== Optimizing the store == | |||
The option and command below save space by hardlinking store files: | |||
==== Automatically ==== | |||
<syntaxhighlight lang="nix"> | |||
nix.autoOptimiseStore = true; | |||
</syntaxhighlight> | |||
Run the optimise command once since this option only applies to new files | |||
==== Manually ==== | |||
Run <code>nix-store --optimise</code> this will take some time to do | |||
== Garbage collection == | == Garbage collection == | ||
| Line 110: | Line 122: | ||
Keep in mind that all commands like <code>mount</code> and <code>bash</code> point to some executable in <code>/nix/store</code>, so never mount an empty disk over <code>/nix</code> or <code>/nix/store</code>, otherwise you will be locked out until reboot! | Keep in mind that all commands like <code>mount</code> and <code>bash</code> point to some executable in <code>/nix/store</code>, so never mount an empty disk over <code>/nix</code> or <code>/nix/store</code>, otherwise you will be locked out until reboot! | ||
== See also == | == See also == | ||
<references group="cf."/> | <references group="cf."/> | ||