Swapping SD cards between Raspberry Pi devices

Today I had the magical experience of finding a Raspberry Pi 4 that I’d forgotten I had. It was bought for playing retro games but I never used it much. So it’s been moved into the Chocolate Synthbox where it works really well. Transferring the program code was very easy. I just removed the sd card from the existing device and popped it in my “found” one.

It just worked. The only problem was that ssh (which provides the secure terminal connection between my desktop PC and the synthbox) got upset because some of the properties of the network connection hardware were different after the swap. If you ever have this problem the solution is quite simple. Open up a command shell and navigate to the folder .ssh folder.

cd .ssh

Now use notepad (or your editor of choice) to open up the known hosts file:

notepad known_hosts

Now you have to delete the line of the hosts file that refers to the machine named in the sd card that you have just moved. Next time you try to connect to that machine the ssh command will make a new entry in the file for the new machine.

I was moving the card between one Raspberry Pi 4 and another. I’m not sure what would happen if you moved it to a different model of Pi.