Author: Alessandro Marchioro - Written and Published on 2024-10-24 21:29

Migrating systems via network & SSH with minimal downtime

Hi everyone! Today I have a follow-up on a blog post I made earlier this year about 1:1 cloning of a physical or virtual system (SSD upgrade, notebook change or similar)... this time done live over ethernet or wifi!

But... why?

There are two reasons:

Compatibility

The main dependencies are two USBs for booting a linux distro, both with ethernet or wifi access, and they need to be accessible from both parties to work with.

The clever trick is...

...using dd in conjunction with ssh to copy it in-place over the network!

We need both machines with root user and ssh access over the network (I suggest the Arch Linux ISO available here), so configure them and try ssh-ing each other and make sure the tunnels are properly configured (you probably need to enable PermitRootLogin under sshd_config file), and then just run the following command (adapted with the correct disk paths on each side, obviously!):

dd if=/dev/old_disk_path bs=1M conv=noerror,sync | ssh root@IP_OF_NEW_MACHINE "dd of=/dev/new_disk_path"

... it's simply... ✨ magic ✨!

You will not need additional drives, you will not use write cycles on anything other than the new drive, which you can't even avoid, so :)

Conclusions

I hope it helped someone as it always has helped me in my work and homelab projects!


If you fancy see what I'm working on, have a look at my GitHub or write me an email!