How to migrate Ubuntu 16.04

Prerequisites

Create an Exoscale SOS Bucket and Add an IAM Key

Log in to the Exoscale Portal and click on STORAGE in the main navigation on the left. Click on the ADD button in the top right of the header to create a new bucket and select a zone.

Create Bucket

Next, click on IAM in the main navigation and create a RESTRICTED key for your bucket.

Create IAM key

Save key and secret. Please do not share your IAM key or secret with any third parties.

Create IAM key

Preparation of the Existing Server

Collect network information from your system, such as the IP address and subnet mask, and default gateway:

To get your system information:

  1. The command ip a shows the current network configuration.
  2. The IP address is shown in format aaa.bbb.ccc.ddd/24. You can calculate the subnet at heise.de (in German) or use another subnet calculator. For example, IP address/28 = subnet mask 255.255.255.0. This info will be needed later.
  3. The command ip route show shows the current gateway in the line starting with default.

If necessary, make sure to clean up your memory for at least 300 MB free space. We suggest you remove old kernel + intramfs files.

Perform a reboot

Load the file clonezilla.iso into the folder /boot.

sudo curl https://coe-template-bucket.sos-at-vie-1.exo.io/clonezilla/clonezilla.iso -o /boot/clonezilla.iso

Add it to GRUB2 bootloader.

mkdir -p /root/backup
cp /etc/grub.d/custom /root/backup
cp /etc/default/grub /root/backup
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/grub -o /etc/default/grub
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/custom -o /etc/grub.d/custom
update-grub2

Clonezilla on your Existing Server

Log in as root in the console and then reboot your system Select Clonezilla Live in Grub menu.

Start Clonezilla and set up the configuration

Select the language:

Select Language

Select keyboard

Select keyboard

Select keyboard

Select keyboard

Start Clonezilla

Select location

Choose location 2

Configure the network settings

Select network connection

Select the option static.

Select IP address

Enter the network information you collected in Step 2:

Enter IP address

Enter network mask

Add gateway

Enter nameserver

Configure the S3 bucket you have set up

Set up S3 bucket

Enter the following commands as shown in the screenshot with the data of your SOS bucket:

echo "key:secret" > /root/.passwd-s3fs

chmod 600 /root/.passwd-s3fs

s3fs bucketname /home/partimag -o url=https://sos-at-vie-1.exo.io

Verify your input with df -h.

Select IP address

End this session with the command exit to return to the setup.

Select IP address

Create the image

Select Beginner

Start wizard

Leave the selection savedisk and click Enter.

Select Savedisk

You can choose a name for your backup. Make sure to write it down, because you will need it later.

Assign name

Do not change anything here and click Enter.

Select disk

You can skip the next steps by clicking Enter.

Select compression method

Select check method

Check image

Select encryption

Select Reboot and click Enter when the prompt appears.

Reboot

To confirm this step, type y and then click Enter.

Confirmation

Now the backup of your data is running. After backup is complete, the server will reboot.

Backup is running

Add an Ubuntu template on Exoscale

  • Log into the Exoscale Portal.
  • Go to COMPUTE, then TEMPLATES, and click on the ADD button in the top right of the header.
  • Enter in the form fields as follows:
Zone: AT-VIE-1
Name: Ubuntu 16.04 Cloud
Source URL: https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/ubuntu_16.04.qcow2
Checksum: 188eb956ca5879a15feedebd186200f4

After you click on the toggle to enable SSH, add:

Login Username: ubuntu

Register template

While setup of SSH keys on Exoscale is not in the scope of this guide, you can find more information in our documentation section on SSH Keypairs and Security Groups.

Start Template

Setting up the firewall

In the Portal, go to the COMPUTE, and then SECURITY GROUPS.

You can use the default Security Group or create your own. To configure the firewall correctly, make sure to enable access via SSH.

Control firewall

Create a new instance using your new template

  • Go to COMPUTE, then INSTANCES and click on the ADD button in the top right of the header.
  • Select the Template.
  • Note: Your disk space should be at least the same size on Exoscale as on your old server.
  • Hostname should be the same as on your old server as well.

Start instance

Starting your new Exoscale server

  • Open the console in the Portal from the instance detail view. - Click on Send CtrlAltDel to restart the instance.
  • Select Clonezilla live in the Grub menu.

Boot with Clonezilla

Select the language:

Select language

Select keyboard 1

Select keyboard 2

Select keyboard 3

Select keyboard 4

Select keyboard 5

Select the mode: “Start Clonezilla” !

Start Clonezilla

Select device-image.

Select mode

Go to the s3_server item.

Select location

Select dhcp only.

Configure network

Configure the S3 bucket

Configure S3 bucket

Enter the following commands as shown in the screenshot with the data of your SOS bucket:

echo "key:secret" > /root/.passwd-s3fs

chmod 600 /root/.passwd-s3fs

s3fs bucketname /home/partimag -o url=https://sos-at-vie-1.exo.io

Verify your input with df -h.

Check input

End this session with the command exit to return to the setup.

Select Beginner.

Select mode

In the following menu, select restoredisk.

Configure S3 bucket

Enter the name for your backup, that you created in step 3.

Start Clonezille

You do not need to make any changes here.

Select the name of the target disk

Leave the settings here as well and click Enter.

Check image

Select Restart.

Perform reboot

Perform reboot 2

Confirm this step by typing “y” and then click “Enter”.

Confirm operation

To confirm this step, type y and then click Enter.

Confirm operation 2

Log into the web console again

  • Log into the web console for your instance in the Exocale Portal as root (with the password of your old server)
  • Modify the /etc/network/interfaces file with a text editor as shown:

Configure network

  • Perform a reboot of the system
  • You can login again with SSH (but make sure to set up the Security Group correctly including port 22)

Remove Clonezilla and Grub to free up disk space

Run the following commands on the new server:

/bin/cp -f /root/backup/40_custom /etc/grub.d/40_custom
rm -f /boot/clonezilla.iso
update-grub2

Add Cloud-Init to the System (Optional)

Run the following commands on the new server:

apt-get update
apt-get upgrade
reboot
apt-get install cloud-init cloud-guest-utils cloud-initramfs-copymods cloud-initramfs-dyn-netconf
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/apt.cfg -o /etc/cloud/cloud.cfg.d/apt.cfg
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/root.cfg -o /etc/cloud/cloud.cfg.d/root.cfg
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/dpkg.cfg -o /etc/cloud/cloud.cfg.d/dpkg.cfg
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/ssh.cfg -o /etc/cloud/cloud.cfg.d/ssh.cfg
reboot