How to migrate a Droplet from Digital Ocean to OpenStack

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 mount it to an existing instance.

Follow this tutorial if you would like to mount the data to a new instance instead.

The below tutorial is derived from this PDF and this tutorial

Requirements

  • Root access to the Digital Ocean Droplet.
  • Password for Root on the Digital Ocean Droplet.
  • A Fuga Instance.
  • Ability to create an SSH-session from the Droplet to the Fuga Instance.

Exporting 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, transfer it over SSH to the Storage Location to a file called snapshot.image. We also want to get some information about the progress of this process, status=progresstakes care of that.

Don’t forget to fill in the SSH-data.

dd if=/dev/vda1 | ssh ubuntu@fuga_instance sudo dd of=snapshot.image status=progress

Determining the type of data

Note: These actions are performed on the Fuga Instance

Note: You’ll need enough space on your Fuga Instance.

You might have copied your whole disk instead of only your filesystem, to check this

fdisk -l snapshot.image

If you see more than one device, you have not copied only one partition but multiple. Go to the Mount with multiple partitions part If you only see one device, you have only copied one partition. Go to the Mount with single partition part

Mount 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.

At this point you can manually mount the dd image file by executing the following commands, please fill in the offset you determined the last step:

losetup -o ***offset*** /dev/loop1 snapshot.image
mkdir snapshot
mount /dev/loop1 snapshot

Mount with a single partition

At this point you can manually mount the dd image file by executing the following commands :

losetup /dev/loop1 snapshot.image
mkdir snapshot
mount /dev/loop1 snapshot

In this tutorial, you have learned how to export data from a Digital Ocean droplet and mount it into an existing Fuga Instance. If you have any more questions, feel free to contact us!