- Prepare the new disk according to the Partitioning Information up to the point just before mounting the swap/disks
- Update the hardware configuration (e.g.
nixos-config/machines/my-machine/hardware-scan.nix
and maybe nixos-config/machines/my-machine/system.nix
) to point to the new partitions
- Mount the new boot partition in-place:
sudo mount $NEWBOOT /boot
- Install the new configuration, including bootloader:
sudo nixos-rebuild boot --install-bootloader --flake .#my-machine
- Reboot into an installation disk
- Mount the old root parition at
/mnt/old
- Mount the new root parition at
/mnt/new
- Copy everything over, preserving creation times with
-N
for syncthing:
rsync -aAXvN --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /mnt/old/ /mnt/new
- Reboot into the new drive and enjoy =)