• UID129
  • Fans2
  • Follows0
  • Posts4

Online Migration For Linux

More Posted time:May 17, 2016 10:54 AM
Table of Contents

  1. Abstract
  2. Prerequisites
  3. Migrating Steps
  4. Issues
  5. Planed Improvement
1. Abstract
This document introduce a method on how to migrate a image from EC2 to ECS. And what's the OS type we already support.

2. Prerequisites
Before we do the experiment, we should have a couple of instances with equivalent OS release version on both side of Cloud providers.
Make sure that the instances are accessible to the Internet.

3. Migrating Steps
In our experiment, we launched two instances, one is an EC2(54.2000.102.210) as a source, another is ECS( as the target instance.
This experiment is aim to migrate the exist system from EC2 to ECS.

Firstly, we should authorize root to login to the EC2 instance.

One method is to config the /etc/ssh/sshd_config file by uncomment these two options to allow root to login by password.

vim /etc/ssh/sshd_config
#Find and uncomment this two lines
PermitRootLogin yes
PasswordAuthentication yes
Save the file and quit.

Then set the root password:

passwd root

If you have been running your applications on your EC2, please top them before the migration.

Secondly, ssh to ECS and install dependencies and migration tool:

apt-get install rsync

Download the ready migrate tool to /tmp and execute command.Ask me to get the migration tool.

In the experiment, I already scp the migrate tool to /tmp/migrate_tool and make it executable.

chmod +x migrate

root@iZu1e533scsZ:/tmp/migrate_tool# ./migrate migrate
[Thu Jan 14 12:13:22 UTC 2016] [INFO] "begin to prepare"
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is 7c:3b:7d:43:cf:5a:2c:2e:2d:e2:e5:05:31:bd:4d:c7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
root@'s password:

After enter your password of EC2 root, the migrating tool will transfer all files of system disk on EC2 except for the run-time files.

sent 277,016,651 bytes  received 161,051 bytes  17,882,432.39 bytes/sec
total size is 1,194,098,631  speedup is 4.31
[Thu Jan 14 12:17:00 UTC 2016] [INFO] "end of migrate"
[Thu Jan 14 12:17:00 UTC 2016] [INFO] "begin to postcheck"
[Thu Jan 14 12:17:04 UTC 2016] [INFO] "end of postcheck"

After migration task has done, the progresses INFOs will be print on stdout.
And in one case, postcheck finally ends with prompt 'failed to re-install grub, you must do it manually'
Then we execute this command to finish the migration:

grub-install /dev/xvda >/dev/null 2>&1

For the cases of some versions of CentOS(7uX) you should run by grub2-install instead.
Moreover, the program will put it's log file in /tmp which named aliyun_migrate.log

At last, resume your applications and do the verification.

4. Issues
Auto check the version of grub-install tool and choose the right one to execute.

5. Planed Improvement

Auto retry
Trash cleanup

  • UID3024
  • Fans0
  • Follows0
  • Posts17
1st Reply#
Posted time:Nov 15, 2017 16:56 PM
where did you download the migration tool from?