Contents

Migrating DigitalOcean droplet to ESX or KVM

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

1. Shutdown the droplet

1
# poweroff

2. Taking a snapshot

/images/take_snapshot.png

3. Deploying a new droplet from the snapshot

/images/choose_image.png

Attach a new larger volume than your disk.

/images/block_storage.png

4. Booting from Recovery ISO

Shutdown the new droplet and boot from Recovery ISO option.

/images/recovery_iso.png

Select “Interactive Shell” option (type 6)

/images/console_droplet.png

5. Extracting the image

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

1
2
fdisk -
mount /dev/sda /mnt
For KVM
1
qemu-img convert -O qcow2 /dev/vda /mnt/droplet-disk.qcow2
For VMDK
1
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

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

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

1
2
3
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