How to migrate a volume from one OpenStack provider to another
Estimated time to read: 4 minutes
In this tutorial you learn how you can migrate small (bootable) volumes from one provider to another, using images. You can not download or upload volumes from one provider to another that’s why you're going to convert the volume into an image. After converting it into an image, you can download the image and upload it to your new provider.
This tutorial was tested on Fuga Cloud using the OpenStack CLI tools client version 3.17.0
We recommend using a small Linux cloud instance on the source or destination platform with the OpenStack CLI tools installed. This way you can make full use of the fast connections of the cloud platforms instead of downloading it to your local machine. This can really speed up the process.
- 2 active OpenStack accounts
- OpenStack CLI tools installed
- A block store or volume (that you would like to migrate)
- OpenStack credentials (open.rc files) from both OpenStack providers.
For big data sets, we recommend rebuilding your platform and sync your data instead of using the method described in this tutorial.
Step 1: Detach your volume
Before creating an image of your volume so that you can download it, you need to detach the volume from your instance.
First, let’s stop your instance where the volume is attached too. You can view the instance name of your instance using the following command:
If the instance is still running you can Shut down your instance using the following command:
Next, you need to detach the volume from the instance it is mounted on. First, let’s check the volume ID
You can detach the volume using the following command:
If the volume is detached, you can go to step 2 otherwise follow Step 1.1 in the dropdown below.
To create an image of an attached volume, you're first going to create a snapshot from our bootable volume. After that, you're going to create a new volume from that snapshot. This way you have a volume that is unattached, so that you can create an image of that volume.
First, let’s create a snapshot of the (bootable)volume
You can see if the snapshot is listed:
Now let’s create a new volume from our freshly made snapshot. Please note that the volume size should match the snapshot size.
Step 2: Create an image of your volume
You can not download a volume in OpenStack, so you first have to create an image of your volume so that the image can be downloaded.
Get your image ID using the following command:
Create an image of your volume and give it a proper name using the following command
You can check the status of your image using the following command:
Step 3: Download your image
You can now download your newly created image using the following command
Step 4: Uploading your image to the new OpenStack platform
Make sure you are logged in to the correct OpenStack platform with your CLI tools
Upload your snapshot that you’ve just downloaded using the following command:
Step 5: Creating a volume from an image
You need the image ID of the image that you have uploaded to the new platform. You can obtain this using the following command:
Now you need to create a volume from the image that you have uploaded. You can do that using the following command:
You can check the status of your volume
Start your instance with your bootable volume
You have now learned how you can convert a volume into an image so that you can download it. You showed you how you can upload that image to a new cloud provider and convert it back into a volume. This tutorial is an easy way to migrate volumes from one provider to another using the OpenStack CLI tools.