Migration guide for Ubuntu 16.04
Migration guide for Ubuntu 16.04
Prerequisites:
- Existing Ubuntu instance with 16.04 running as VM (containers are not compatible)
- Clonezilla (download) https://clonezilla.org/downloads.php)
Create an Exoscale SOS S3 bucket and add an IAM key
Log in to your EXOSCALE portal and click on “Object Storage”.
Create a new bucket and select a storage location.
Click on the left side on “IAM” and create a “restricted” key for your bucket
Now save key and secret.
Note
Please do not share them with others
Preparation of the existing server
Collect network information from your system (IP address + subnet mask and default gateway):
Note
ip a
-> shows the current network configuration- IP is shown in format aaa.bbb.ccc.ddd/24, you can calculate the subnet e.g. here: https://www.heise.de/netze/tools/netzwerkrechner/ eg: IP address/28 = subnet mask 255.255.255.0 -> this info will be needed later on
ip route show
-> show the current gateway in the line starting with “default
Clean up your memory if necessary to have at least 300 MB free space (remove old kernel + intramfs files)
Then 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
First select the language:
Configuring the network settings
Select the option “static” here.
Now enter the network information collected during step 2:
Configure the S3 bucket you have set up in advance on EXOSCALE
Please enter the following commands - as shown in the screenshot - with the data of your S3 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
Please verify your input with the command: 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 (please write it down, because it will be needed later)
Please do not change anything here and click “Enter”.
You can skip the next steps by clicking “Enter”.
Please select “Reboot” and click “Enter” when prompted.
Confirm this step by typing “y” and then click “Enter”.
Now the backup of your data is running, afterwards the server will reboot.
Register Ubuntu template on Exoscale
- Now please log in to portal.exoscale.com
- Go to Compute -> Templates -> AT-VIE-1 -> Register
- Fill in the fields as follows:
Description: Ubuntu 16.04 Cloud
Download URL: https://coe-template-bucket.sos-at-vie-1.exo.io/ubuntu_16.04/ubuntu_16.04.qcow2
MD5 Checksum: 188eb956ca5879a15feedebd186200f4
User: ubuntu
Setting up SSH keys and the firewall on Exoscale is outside the scope of this document. You can find more information in the community section of EXOSCALE: https://community.exoscale.com/documentation/compute/ssh-keypairs/ https://community.exoscale.com/documentation/compute/security-groups/
Setting up the firewall
In the EXOSCALE portal, go to the Compute -> Firewalling menu.
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 this template
- Go to Compute -> Instances -> Add
- Select the rightmost tab for Template
- 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
Starting your new EXOSCALE server
- Open the console in Exoscale and click on “Send CtrlAltDel” to restart the instance
- Select “Clonezilla live” in the Grub menu
Select here, as before, the language
Select the mode: “Start Clonezilla” !
Now select “device-Imag” here
As before, go here to the “s3_server” item
Select “dhcp” only
Configure the S3 bucket
Please enter the following commands - as shown in the screenshot - with the data of your S3 bucket. - Please enter your created key instead of key and the corresponding secret instead of secret.
echo "key:secret" > /root/.passwd-s3fs
chmod 600 /root/.passwd-s3fs
s3fs bucketname /home/partimag -o url=https://sos-at-vie-1.exo.io
Please check your input with the command: df -h
End this session with the command: exit to return to the setup.
Now select “Beginner
In the following menu, please select “restoredisk
Enter here the name for your backup, which you have chosen in step 3.4
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”
Confirm also in this step by typing “y” and then click “Enter”.
Logging into the web console again
- Log in to the Exoscale web console as root (with the password of your old server)
- Modify the /etc/network/interfaces file with a text editor (e.g. nano or vim) as shown in the following screenshot:
- After that, perform a reboot of the system
- You can login again with SSH (you need to set up the “security group” correctly including port 22)
Remove Clonezilla and Grub to free up disk space
- Run the following tasks/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