In this Blog, we explain how to Convert EC2 Instance PV to HVM Virtualization Type.
Scenario: Convert t1.micro to t2.micro instance type conversion
As t1.micro is PV (Paravirtual) machine and t2.micro is HVM (Hardware-assisted Virtual Machine)
Note: please take a backup before performing the conversion.

Steps before converting from AWS EC2 PV to HVM:

  1. Go to the AWS Console and launch a new HVM instance (Amazon 64-bit Linux AMI, t2.micro).
  2. Stop the PV instance. Take a snapshot of the root device and create a new volume (SOURCE VOLUME) from this snapshot.
  3. Stop the HVM instance. Take a snapshot of the root device on the new instance and create a new volume (TARGET VOLUME) from this snapshot.
  4. Using the AWS Console:
    1. Attach SOURCE VOLUME to the new instance as /dev/xvdf.
    2. Attach TARGET VOLUME to the new instance as /dev/xvdg.

Steps for actual converting from PV to HVM process:

  1. SSH to the new instance and get root access:
    • sudo su –
  2. Mount the source and target drives.
    • mkdir -p /mnt/source && mount /dev/xvdf /mnt/source
    • mkdir -p /mnt/target && mount /dev/xvdg1 /mnt/target
  3. Delete everything but /boot on the target volume:
    • cd /mnt/target && ls | grep -v boot | xargs rm -Rf
  4. Delete /boot on the source volume:
    • rm -Rf /mnt/source/boot
  5. Copy the source volume’s data to the target volume preserving all the attributes:
    • rsync -aAXHPv /mnt/source/ /mnt/target
  6. Stop the system and detach all volumes using the AWS console. Attach the TARGET VOLUME on the new instance as /dev/xvda.
  7. Start your HVM instance. It should now be an exact duplicate of your PV system. If everything looks OK, you may now delete your PV instance and also SOURCE VOLUME.
  8. Attach Elastic IP of the old server to new HVM instance.

Now you came to know how to Convert EC2 Instance PV to HVM Virtualization Type.