If you ever need to get a fresh install of your cloud server, but would also want to retain the IP addresses from your old host, then this guide is for you. The storage devices containing the operating system for your servers are easy to configure, move and remove using the features at your UpCloud control panel.
In essence, to reinstall the OS for your server, you will need to deploy a temporary new host with the OS of your choice, replace the old server storage with the freshly installed disk, and you are done. Follow up below with the exact steps on how this is done.
Deploy a new identical server
To start with, log into your UpCloud control panel and deploy a new cloud server.
On the deployment page, make the following configurations:
- Select the same location and plan as your current server
- Name the storage device such that you’ll recognise it later
- Pick the operating system you want
- Include any SSH keys
- Add the following initialization script to automatically shut down the server after deployment
shutdown -h 1
- In the last step, set the hostname and description the same as your current server
Once you are done configuring the new host, click the Deploy button at the bottom of the page.
Moving the fresh install
While waiting for the new server to finish deploying, shut down the current host either at the server list or in your server settings.
If you included the shutdown script at deployment, the new server should also be powered down. Otherwise, shut it down manually.
Next, open the settings of the newly deployed server and go to the Storage tab. Click the eject icon to detach the storage device.
Then, open the server settings of your current server. With the server powered down, go to the Storage tab to continue.
Detach the first device as you did above if you wish to keep it as a backup, or optionally you can delete it right away by clicking the bin icon if it’s no longer needed.
Finally, add the new device by clicking the Attach existing storage button. Then find the new disk by its name on the list of available storage devices, your free storage devices are at the top of the list.
With the right device selected, click the Add a storage device button to confirm.
Once the storage is attached, you can go ahead and boot up the server again with the clean installed OS. Log into the host using the new root password or any SSH keys you may have assigned at deployment and confirm the server is working properly.
Afterwards, you can delete the temporary server from the server settings.
The old storage device can also be deleted from your Storage list if you no longer need it.
If the server is having connectivity problems after the system device swap, you can use VNC or the web console to log in. For servers running CentOS 6.7 or older and Ubuntu 12.04 or older, you may need to remove the old MAC address reference file and restart the server.
sudo rm /etc/udev/rules.d/70-persistent-net.rules sudo reboot
Then test the network connectivity again.
You should now have a clean installation of the OS of your choosing up and running with all the previously configured resources. To get started again you may wish to take a look at our guide for how to secure your Linux cloud server.
If you know you may need to reinstall the system again in the future, it may be more convenient to take a backup of the fresh install which can then be easily restored in moments. You can find out more about the feature in the guide for taking backups.