Migrating DigitalOcean droplet to ESX or KVM

Mar 12, 2020

The following steps have been tested for a Centos 6 droplet.

1. Shutdown the droplet

# poweroff

2. Taking a snapshot

3. Deploying a new droplet from the snapshot

Attach a new larger volume than your disk.

4. Booting from Recovery ISO

Shutdown the new droplet and boot from Recovery ISO option.

Select “Interactive Shell” option (type 6)

5. Extracting the image

Identify the disks and copy the data from your droplet to storage volume mounted in /mnt.

fdisk -l
mount /dev/sda /mnt
qemu-img convert -O qcow2 /dev/vda /mnt/droplet-disk.qcow2
qemu-img convert -O vmdk /dev/vda /mnt/droplet-disk.vmdk

6. Copying the image

Boot again from the new droplet and copy the image on your KVM server or ESX.

7. Deploying the new image

Create a new KVM machine using virt-manager or virt-install and assign the disk

# virt-install --name droplet_image \
  --ram 1024 \
  --vcpus=1 \
  --os-variant=centos6.10 \
  --graphics vnc \
  --disk path=/var/lib/libvirt/images/droplet-disk.qcow2 \

8. Converting the image for ESX

For ESX you will need to convert the VMDK disk (this step is not required if you have VMware Fusion or Workstation) so upload the image to your ESX server then execute the following commands

cd /vmfs/volumes/datastore1
mkdir droplet-esx
vmkfstools -i droplet-esx.vmdk -d thin droplet-esx/droplet-thin-esx.vmdk

Now it is time to create a new virtual machine and attach the existing disk.

9. Edit configuration files

Power on the new virtual machine and edit configuration files

  • Power on the virtual machine
  • Log in on the server and edit the following files: /etc/sysconfig/network-scripts/ifcfg-eth0 (IP and MAC addresses), /etc/hostname, /etc/hosts, /etc/resolv.conf, etc.
  • Remove the udev file for network: /etc/udev/rules.d/70-persistent-net.rules
  • Reboot
virtualizationlinuxkvmdigital oceandroplet

Expand the file system on a PowerPath pseudo-device

Converting a virtual machine with virt-v2v

comments powered by Disqus