How to migrate a Droplet from Digital Ocean and boot it in a new instance
Estimated time to read: 3 minutes
Unfortunately, Digital Ocean does not provide a way to directly export a droplet and migrate it to Fuga’s OpenStack platform. So we are going to export the data and create an image in OpenStack from it. Follow this tutorial if you would like to mount the data to an existing instance instead.
The below tutorial is derived from this PDF.
- Root access to the Digital Ocean Droplet.
- Password for Root on the Digital Ocean Droplet.
- Digital Ocean Droplet with SSH access enabled.
- Digital Ocean Droplet with the qemu-util package installed. (sudo apt-get install qemu-utils)
- Digital Ocean Droplet with OpenStack CLI installed.
Creating an image from the data
Log into the Digital Ocean Droplet Prepare the Droplet for Backup. Reset root’s password if you do not already know it.
Use DD to byte copy the Digital Ocean partition, to a file called snapshot.image
Change /dev/vda1 to the partition you want to migrate.
Converting the image with multiple partitions
Look at the output of the fdisk -l snapshot.image command you entered before.
Search for the device with type Linux Filesystem and hold on to the start-value.
This start-value is the amount of sectors offset that the partition has on the drive. We have to multiply this by 512 (start-value x 512) to determine the amount of offset in bytes. This value will be used when creating a loop device.
Convert the DD image to a qcow2 disk format with the ‘qemu-img’ utility please fill in the offset you determined the last step.
Converting the image with single partition
Convert the DD image to a qcow2 disk format with the ‘qemu-img’ utility.