Storage optimization: Difference between revisions
imported>Mth m Use syntaxhighlight lang="console" |
imported>OctavioElMagnifico Added detail over the method for changing the store location in nixos. After binding into nix/ the new partition you need to restart the daemon in order to be able to rebuild. Also, for nixos to boot you need to add "neeededForBoot" in the new /nix filesy |
||
| Line 103: | Line 103: | ||
# Create a new ext4 partition and mount it over <code>/mnt</code> | # Create a new ext4 partition and mount it over <code>/mnt</code> | ||
# <code>rsync -a</code> everything from <code>/nix</code> to <code>/mnt</code> | # <code>rsync -a</code> everything from <code>/nix</code> to <code>/mnt</code> | ||
# bind <code>/mnt</code> to <code>/nix</code> (e.g. using <code>mount</code>) and rerun <code>nixos-rebuild switch</code> with something like <syntaxhighlight lang="bash">fileSystems."/nix" = { device = "/dev/disk/by-label/nix"; options = [ "noatime" ]; };</syntaxhighlight> | # bind <code>/mnt</code> to <code>/nix</code> (e.g. using <code>mount</code>), restart nix daemon with <code>systemctl restart nix-daemon.service </code> <code>systemctl restart nix-daemon.socket </code> ,and rerun <code>nixos-rebuild switch</code> with something like <syntaxhighlight lang="bash">fileSystems."/nix" = { device = "/dev/disk/by-label/nix"; neededForBoot = true; options = [ "noatime" ]; };</syntaxhighlight> | ||
# reboot to be sure <code>/nix/store</code> is properly mounted | # reboot to be sure <code>/nix/store</code> is properly mounted | ||
# bind mount <code>/</code> to <code>/old_root</code>, and remove <code>/old_root/nix</code> | # bind mount <code>/</code> to <code>/old_root</code>, and remove <code>/old_root/nix</code> | ||