If you ever need to get a fresh install of your cloud server, but would also want to retain the IP addresses from you 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 can be done.

Create a new disk device

To start with, log into your UpCloud Control Panel and go your Server settings of the host you wish to reset. Request shut down for the host, and once it is powered down, click the Clone server option to continue.

Cloning the server

Next, on the deployment page, make the following configurations:

  • Keep the name, description and availability zone as they are, these should match the settings of the old server.
  • Use the 1 CPU preconfigured instance as it only needs to install the OS disk once.
  • Rename your new OS installation disk so that you will recognise it later and set the disk size as per your requirements.
  • Change the selection for the operating system to one of the Public Templates, choose the OS you want.
  • Select any SSH keys and Initialization script if needed.

Once you are done configuring the new host, click the Deploy server button at the bottom of the page, then wait for the server to finish deploying.

Moving the disk to another host

Shut down the newly deployed server and go to the Disks tab under Server settings. Here you will find the attached disk resources, click the Detach button for Other Actions to disconnect the storage device from the server.

Then go to the Server settings of your old host and the Disks tab there. Detach the first device if you wish to keep it as a backup, or optionally you can delete it right away with the Delete button if it is no longer needed.

Detaching a disk

Finally, click the Attach new disk text and select to Attach Existing and find the new disk by its name around the bottom of the list of available Disk Resources. Click the Accept button when you have found the correct disk to confirm.

Attaching existing disk

Once the disk 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, and the old disk device in your Disk Resources menu if you no longer need it.

You can use VNC or Web Console to log in if the server is having connectivity problems after system disk swap. 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.

Summary

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.