Migrating a server to your new Cloud Server on Clouding can be done in several ways.
Our technicians, the Cloud Pros, have found the perfect syntax to do a "Tar" of your Linux Server with CentOS/RHEL or Ubuntu/Debian, and migrate it directly to your new Virtual Server on Clouding.
You will need to run this command from the source server, and we recommend that you first stop the services on the source server (such as MySQL or Apache) to prevent any new changes or file corruption after starting the copy.
The commands you have to use are the following:
- CentOS/RHEL:
# tar cvpf - --exclude=/etc/sysconfig/network-scripts/* --exclude=/etc/sysconfig/network --exclude=/etc/hosts --exclude=/proc/* --exclude=/dev/* --exclude=/lost+found --exclude=/etc/fstab --exclude=/etc/mtab --exclude=/sys/* --exclude=/boot/* / | ssh root@destination_IP "tar xvpf - -C /"
- Ubuntu 16 or earlier:
# tar cvpf - --exclude=/etc/network/* --exclude=/etc/hosts --exclude=/proc/* --exclude=/dev/* --exclude=/lost+found --exclude=/etc/fstab --exclude=/etc/mtab --exclude=/sys/* --exclude=/boot/* / | ssh root@destination_IP "tar xvpf - -C /"
- Ubuntu 18, 20 or 22:
# tar cvpf - --exclude=/etc/network/* --exclude=/etc/hosts --exclude=/proc/* --exclude=/dev/* --exclude=/lost+found --exclude=/etc/fstab --exclude=/etc/mtab --exclude=/sys/* --exclude=/boot/* --exclude=/etc/netplan/* / | ssh root@destination_IP "tar xvpf - -C /"
Note:
Before launching the command remember to change the Destination_IP to the IP of your new Cloud Server in Clouding.
Once the copy is complete, we recommend you restart the destination server. Remember that it is possible that some applications may not work correctly, as you will have to change the IP of the server in their configuration, replacing the old server's IP with the new server's IP.
To do this we recommend you to do a grep looking for the source IP in /etc/:
# grep -HrF "source_IP" /etc/*
Nota:
If you have migrated a Linux server with the Tar command and you have problems with the server network you can check the following article: How to change network name to interface and configure static IP in Ubuntu 16.04 and Ubuntu 18.04.
We hope we have helped you with this article. If you have any questions about this or any other issue related to your Clouding servers, please contact us at soporte@clouding.io. We are here to help you! 😉