Move Nix Store to new partition: Difference between revisions
imported>Buecking No edit summary |
imported>Buecking No edit summary |
||
Line 41: | Line 41: | ||
Start up nixdaemon | Start up nixdaemon | ||
$ sudo systemctl start nix-daemon.service | |||
$ sudo systemctl | |||
[[Category:Tutorial]] | [[Category:Tutorial]] | ||
[[Category:NixOS]] | [[Category:NixOS]] |
Revision as of 21:32, 8 February 2019
Moving nix directory to a new device
The tutorial will teach you how to relocate `/nix` to a new device.
The device that /nix is on has no more space
$ du -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 182G 180G 2G 99% /
Stop nix daemon
$ sudo systemctl stop nix-daemon.service
Move backup /nix; mv /nix to /nix.bak
$ ls -alF /nix total 1068 drwxr-xr-x 4 root root 4096 Jan 22 02:43 ./ drwxr-xr-x 26 root root 4096 Feb 8 12:17 ../ drwxrwxr-t 1555 root nixbld 1077248 Feb 8 12:05 store/ drwxr-xr-x 4 root root 4096 Jan 22 02:43 var/ $ cd / $ tar -afp /nix.tgz /nix /nix.bak $ sudo mv /nix /nix.bak # incase something goes horribly wrong
Mount new device. You will need to add this device to `/etc/fstab`
$ mount /nix $ du -h Filesystem Size Used Avail Use% Mounted on /dev/sdb1 300G 0G 300G 0% /nix
Restore /nix from /nix.tgz; verify contents
$ cd / $ sudo tar -xf /nix.tgz $ nix-store --verify --check-contents
Start up nixdaemon
$ sudo systemctl start nix-daemon.service