Welcome to bytebang » The blog about all and nothing » How to migrate a vServer from netcup to another instance

How to migrate a vServer from netcup to another instance

Jan 02 2018

The Problem

Well - I am a huge fan of visualization. This is the reason why several web presences (like simpledashboard.io and a few others) are running at virtual hosts at my favorite provider netcup.de

I like it to set up and customize my own web hosting solution - because then there are (except hardware limitations) nearly no other restrictions. But even with all this beauty, things tend to become complicated if your server reaches its limits - or just gets old. Then you have to upgrade to a new hosting plan with more powerful hardware.

Since I have not found any manuals how to do this I decided to write my own - here it is!

In the next few paragraphs, I will describe how I transferred my vServer from one hosting plan to another within 3 hours.

The Solution

The first step is to find a new hosting plan. Either you grab one of these vServers, or you do the same as me, and wait till a cheap offer was on the horizon: I decided to wait till black Friday and bought an entirely new instance with 8GB RAM, 8vCPUs and 320GB HDD for 6.99 € per month.

So I ended up with my old (slow) server which was hosting several homepages and other services and a completely fresh one. The next step was to move all the data from the old one to the new one.
Backup the data from the old server

Backup the data from the old server

On my old server I performed the following steps through the server control panel

  • Delete all existing snapshots
  • Defragment the disk (dont forget to disable automatic boot after the action)
  • Take a new offline snapshot
  • Export the snapshot (If you have no export left then you can purchase one for 1.50 €)

This procedure makes sure that you will end up with a complete backup of your old vServer which can be accessed via FTP from everywhere in the world. The old server should be turned off - so there will be no conflicts when another server with the same settings comes up.

Import the data into the new server

Then I switched within the SCP to my new server and imported the previously created backup via the submenue Media - Images - Own Images.

This takes a few minutes and after that, the server is (technically) ready to run - but as soon as I started it, I stumbled into some troubles:

Grub did not find the disk with the uuid ....

I thought - well that's not a big problem, i just have to adjust the uuids, but unfortunately GRUB could not find any harddisks. After trying around for a few minutes, it turned out that I forgot to set the correct HDD Driver (the old server used VIRTIO and the new one was configured to use SCSI). After setting it back to VIRTIO again, the server finally booted.

After one hour the server booted - but some services (like tomcat and also my webserver) were unable to start. They showed very unspecific error messages:

INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 26, 2017 1:15:59 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 23817 ms
Dec 26, 2017 1:15:59 PM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[localhost:8005]:
java.net.BindException: Cannot assign requested address (Bind failed)
 at java.net.PlainSocketImpl.socketBind(Native Method)
 at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
 at java.net.ServerSocket.bind(ServerSocket.java:376)
 at java.net.ServerSocket.<init>(ServerSocket.java:237)
 at org.apache.catalina.core.StandardServer.await(StandardServer.java:426)

Well - f*ck.

Adjust internal server settings

I started to look around in the system and discovered that the IP address was obtained correctly via DHCP. So my next best guess was that the web server was configured to bind to the old public IP - but this was not the case. It tried to bind to localhost.

After i tried to ping localhost the error became clear:

$ ping localhost
PING localhost.luckysrv.de ( 56(84) bytes of data.

It turned out that localhost was not resolved to but to something else. So I modified the /etc/hosts file by adding the following statement to it:     localhost

From there on all services were able to start as usual. Since the new hardware had more performance than the old one, it was possible to extend memory limits for some applications (like tomcats maximal memory consumption in /etc/defaults/tomcat7)

I was able to test that the server comes up with all services by surfing to them with the lynx browser, but it still could not be reached from the internet as usual.

Adjust external settings

The last stage was to adjust external links to my server which are using plain IP addresses as well as the DNS records for all domains which where pointing to it. This could also be done in the Server Control Panel.

From there on I (and everyone else) was able to access the old services with new speed. The whole downtime was about 3 hours.

Get Social

(c) 2024, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen