Move installation to new disk

I am trying to migrate my old disk to a new one without re-installing everything (read re-downloading the entire Internet / copying stuff as much as possible from the old one). Considering that the old disk

  • contains my boot partition, home partition, swap device and the nix store,
  • is formatted in ext4 (and the new one is in btrfs),
  • is of different capacity from the new one.

What would be the most efficient / successful procedure to transfer all of the above partitions to the new drive using my current configuration ?

I tried copying my boot partition, home partition and created a new swap partition on the new drive. Changed my hardware configuration to match the new changes but to no avail : I am getting an error regarding udev in stage 1 preventing me from reaching stage 2.

1 Like

My initial suspicion would be the /etc/fstab, since it should use UUID which now doesn’t match with your new disk.

What’s the error in stage 1? I’d like to see success here since I’d like to do this one day.

That’s the problem, the console reads : An error occured at stage 1 of the boot process, which must mount the root filesystem on /mnt-root and then start stage 2

Seems like the error can pop up for a variety of reasons. Check out Reddit - Dive into anything - might have some useful stuff. Otherwise, perhaps you need to fix the disk with fsck; sorry I can only provide links you might have already seen How to fix a (slightly) broken root filesystem on NixOS VM image

You may need to share some configuration details for us to be able to help you further.

My first guess is that you might need to add btrfs to your boot.supportedFilesystems

boot.initrd.supportedFileSystems, not boot.supportedFileSystems, if the problem is in stage 1

It probably reads more than that before that message though. You’ve just posted the generic error message; something more specific probably happened first.

any luck with this @TheSirC?

No, I am sorry : right now I am in update hell. I am trying to bump my nixpkgs to this commit 58fdb93 for other reasons.

But of course it does not build, so I am just waiting before transferring to the new disk (to be able to tell which part of the process is breaking what). I will come back to the transfer issue (soon I hope) and post my findings (problems ?) here.

1 Like