How can I migrate from one VPS to another, while keeping the configurations?
I saw this question Best way to migrate data between two linux VPS
But that was only to migrate the data.
I have set up an email server (Dovecot/Postfix) which is a pain to set up, Tomcat, PHP, Apache, Webmin, etc. and would like to copy the configurations for them without having to set everything up again.
I'm afraid if I copy the root directories, there will be special files like /dev that should not be copied.
I went through that exact task a few days ago. The steps I performed was essentially this:
mount --bind / /mnt/servername
tar -C /mnt -c servername | ssh user@newserver dd of=copy.tar
Step 5 becomes a lot simpler if the destination VPS offers management features such as netboot, virtual console, etc. The VPS I was migrating to offered both of the above. The virtual console was utilizing a VNC client connecting to the hypervisor for access to the virtual display.
If you don't have such management features, you need to get that step right in the first try. And updating the boot loader is challenging.