Tutorials Reinstalling your server while keeping the IP addresses

Reinstalling your server while keeping the IP addresses

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 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
    Name the storage device
  • Pick the operating system you want
  • Include any SSH keys
  • Add the following initialization script to automatically shut down the server after deployment
    #!/bin/bash
    shutdown -h now

    Script to shutdown after deployment

  • At the last step, set the hostname and description the same as your current server
    Name the new 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.

Shuting down the current server

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 Resize tab. Click the eject icon to detach the storage device.

Detaching the freshly installed storage device

Then, open the server settings of your current server. With the server powered down, go to the Resize 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, click the Add new device and select to Attach existing device. Then find the new disk by its name on the list of available storage devices. With the right device selected, click the Add a storage device button to confirm.

Attaching existing storage device

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.

Cleaning up

Afterwards, you can delete the temporary server from the server settings.

Delete temporary server

The old storage device can also be deleted at your Storage list if you no longer need it.

Delete the old storage device

If the server is having connectivity problems after 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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Locations

Helsinki (HQ)

In the capital city of Finland, you will find our headquarters, and our first data centre. This is where we handle most of our development and innovation.

London

London was our second office to open, and a important step in introducing UpCloud to the world. Here our amazing staff can help you with both sales and support, in addition to host tons of interesting meetups.

Seattle

Seattle is our 4th and latest office to be opened, and our way to reach out across the pond to our many users in the Americas.

Singapore

Singapore was our 3rd office to be opened, and enjoys one of most engaged and fastest growing user bases we have ever seen.