How to migrate Ubuntu 16.04
Migration Guide for Ubuntu 16.04
Prerequisites:
- An existing Ubuntu instance with 16.04 running as VM (containers are not compatible)
- Clonezilla: https://clonezilla.org/downloads.php
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.
Next, click on IAM
in the main navigation and create a RESTRICTED
key for your bucket.
Save key and secret. Please do not share your IAM key or secret with any third parties.
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/40_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/40_custom -o /etc/grub.d/40_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:
Configure the network settings
Select the option static.
Enter the network information you collected in Step 2:
Configure the S3 bucket you have set up
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
.
End this session with the command exit
to return to the setup.
Create the image
Select Beginner
Leave the selection savedisk and click Enter.
You can choose a name for your backup. Make sure to write it down, because you will need it later.
Do not change anything here and click Enter.
You can skip the next steps by clicking Enter.
Select Reboot and click Enter when the prompt appears.
To confirm this step, type y
and then click Enter.
Now the backup of your data is running. After backup is complete, the server will reboot.
Add an Ubuntu template on Exoscale
- Log into the Exoscale Portal.
- Go to
COMPUTE
, thenTEMPLATES
, and click on theADD
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
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.
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.
Create a new instance using your new template
- Go to
COMPUTE
, thenINSTANCES
and click on theADD
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.
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.
Select the language:
Select the mode: “Start Clonezilla” !
Select device-image.
Go to the s3_server item.
Select dhcp only.
Configure the 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
.
End this session with the command exit
to return to the setup.
Select Beginner.
In the following menu, select restoredisk.
Enter the name for your backup, that you created in step 3.
You do not need to make any changes here.
Leave the settings here as well and click Enter.
Select Restart.
Confirm this step by typing “y” and then click “Enter”.
To confirm this step, type y
and then click Enter.
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:
- 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/80_apt.cfg -o /etc/cloud/cloud.cfg.d/80_apt.cfg
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/80_root.cfg -o /etc/cloud/cloud.cfg.d/80_root.cfg
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/90_dpkg.cfg -o /etc/cloud/cloud.cfg.d/90_dpkg.cfg
curl https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/80_ssh.cfg -o /etc/cloud/cloud.cfg.d/80_ssh.cfg
reboot