Nowadays you can choose from hundreds (if not thousands) of cloud hosting providers and there is always a chance that you will have to change your current provider. Currently OpenStack is one of the most popular cloud projects.

  • So if you decided on migration, there are always two main migration options:
  • The first approach should be used if your new cloud provider is not compatible with the old one. But keep in mind that it will take pretty much time.

The second one is much faster but requires your team to have an excellent DevOps experience. And here I want to share our experience of fast migration from one OpenStack provider to another. Lets go step by step:

1) The first step is to create a virtual machine with two virtual hard drives at your new cloud provider and connect to it via ssh. There you should install OpenStack client and qemu utils.

2) Now you can list available instances:

3) And create snapshot:

4) Once the snapshot is ready, you should download it to your new server:

5) List virtual hard disks with lsblk-command. You’ll see something like this:

6) If there is no need to extend disk size, you can use dd command to copy image to your virtual drive. Skip 6a step!
* If you you have bigger disk on the new virtual machine and want to extend partition size – use rsync. In this case, you can mount unconverted qcow2 image with qemu-tools and skip steps 6b and 7.

6a) Create new partition and copy data from image

6b) Convert image to RAW-format

qemu-img convert $IMAGE_NAME.qcow2 $IMAGE_NAME.raw

7) Run copy:

dd if=/path/$IMAGE_NAME.raw of=/dev/vdb bs=16M oflag=direct

8) Update partition info:

9) Mount created partition and temporary api filesystems:

10) Chroot to new file system:

11) Install grub to make sure your system will boot properly:

12) If you dont have ssh-key or don’t know root password, you can add user, add ssh-key and make him sudoer.

13) Exit chroot and poweroff. Detach first hdd(vda in this exaple) and start the machine.

This way you got a full copy of your old server without any knowledge about specific services inside. In our case we had to migrate over 10 servers at once. This approach saved us a lot of time and I hope it will save your time in future.

Questions? Comments? Let’s talk about them in the comments section below.

How useful was this post?

Click on a star to rate it!

Average rating 4.9 / 5. Vote count: 14

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


CMO at Rubyroid Labs

Write A Comment slot gacor game slot online Slot88 slot deposit pulsa tanpa potongan