Hetzner - DokuWiki

How to migrate vServers to Cloud/en

Inhaltsverzeichnis

Migration from vServer to Cloud

You may migrate existing VQ/VX/CX vServer to the current Cloud Server

steps of migration:

  1. creating of similar or more powerful cloud server
  2. start the rescue system on the both servers and mount filesystem
  3. trigger the synchronization with rsync

Disclaimer: Individual installations may require different or more steps.

important information

The following operation systems are not supported.

  • Debian 6 and older
  • Ubuntu 11.10 and older
  • CentOS 5.6 and older
  • OpenSuse 11.4 and older

For the listed operation systems is an upgrade to newer version necessary.

Before migrating, all packages MUST be upgraded to the minimum supported version. Partial upgrades and/or operating systems with packages from 3rd party repositories may not work as as expected and are not supported.

activate the rescue system

To transfer the data, you will boot the server into the rescue system. You may activate the rescue via robot and cloud panel.

mount of the filesystem

After the start of the rescue system, you will mount the filesystem to copy files.

On the VQ/VX/CX vServer are set up a different controller. Please check the partitions via:

$ fdisk -l


You may mount the filesystem via.

$ mount /dev/XXXY /mnt

Please substitute XXX with the device declaration and Y with the partition number.

Mounting of swap partition :

$ swapon /dev/XXXY


If exists a boot partition, so mount the main partition at first and in the end the boot partition.

The mountpoint for the boot partition is /mnt/boot.

You will mount the filesystem of the cloud server later.

Change to DHCP

Debian/Ubuntu

edit of  /mnt/etc/network/interfaces

Remove lines like z.B. auto ens3, iface ens3 inet static .

auto eth0
iface eth0 inet dhcp
iface eth0 inet6 static
    address
    netmask 64
    gateway fe80::1

Remove further lines  likes address, netmask and gateway in the IPv4 part (iface eth0 inet dhcp) .

CentOS und openSUSE

rm /mnt/etc/sysconfig/network-scripts/route-eth0

edit of  /mnt/etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO=dhcp

Remove lines like IPADDR, NETMASK, SCOPE and BROADCAST.

Arch Linux

If the installation of ArchLinux performed with our ISO or installimage, so will used systemd-network.

Edit of /mnt/etc/systemd/network/network/10-ens3.network (In some cases 10-eth0.network too!)

[Match]
Name=eth0
[Network]
DHCP=ipv4

Remove lines like address and Gateway.

Removing the udev-rule of the network interface card

Every virtual server has a unique MAC, please remove the current udev-rule in preparation of the migration.

rm /mnt/etc/udev/rules.d/70-persistent-net.rules
rm /mnt/etc/udev/rules.d/80-net-setup-link.rules

Arch Linux

Create a link with /dev/null. For that reason the NIC is called eth0 again.

$ ln -s /dev/null /etc/systemd/network/99-default.link

Migration to Cloud Server

delete the drive

As first step please delete drives of the cloud server.

$ mkfs.ext4 /dev/sda1

mount the filesystem on the cloud server

$ mount /dev/sda1 /mnt

migration

The data transfer will be performed with rsync

$ rsync -avz --progress IP-old-server:/mnt/* /mnt

Adjustment of fstab on the cloud server. This is procedure is necessary, otherwise the server is not able to boot up.

Read out the UUID of the partitions.

$ blkid -o value -s UUID /dev/sda1

Example /mnt/etc/fstab with UUID before

UUID=bad16011-8988-4c53-ba5c-6727f8b90001 / ext3 defaults 0 0

adjust to

UUID=bad16011-8988-4c53-ba5c-6727f8b90001 / ext4 discard,errors=remount-ro 0 1

GRUB

The bootloader has still the old configuration. Now update the configuration via the following commands.

Debian/Ubuntu

$ chroot-prepare /mnt ; chroot /mnt
$ grub-mkdevicemap
$ grub-install /dev/sda
$ update-initramfs -u

On Debian 9 before running the following commands the file /etc/default/grub has to be edited:

GRUB_CMDLINE_LINUX="net.ifnames=0"

This will cause the network card to be available in the system as eth0 instead of ens3. Now run the next commands:

$ update-grub
$ exit

CentOS 6

$ chroot-prepare /mnt ; chroot /mnt
$ grub-install /dev/sda

Please adjust the UUID in /boot/grub/grub.cfg on your own, because the bootloader will be not updated via grub-install.

After the adjustment of /boot/grub/grub.cfg, perform the following commands.

$ dracut -f
$ exit

CentOS 7

$ chroot-prepare /mnt ; chroot /mnt
$ grub2-install /dev/sda $ grub2-mkconfig -o /boot/grub2/grub.cfg
$ dracut -f
$ exit

Arch Linux

$ chroot-prepare /mnt ; chroot /mnt
$ grub-install /dev/sda
$ grub-mkconfig -o /boot/grub/grub.cfg
$ mkinitcpio -p linux
$ exit

openSUSE

$ chroot-prepare /mnt ; chroot /mnt
$ grub2-install /dev/sda
$ grub2-mkconfig -o /boot/grub2/grub.cfg
$ mkinitrd
$ exit

last steps at the Cloud Server

To use the cloud server again, please umount the filesystem

unmount the filesystem

$ umount -R /mnt

restart the server

$ reboot


© 2019. Hetzner Online GmbH. Alle Rechte vorbehalten.