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.
- Go to the AWS Console and launch a new HVM instance (Amazon 64-bit Linux AMI, t2.micro).
- Stop the PV instance. Take a snapshot of the root device and create a new volume (SOURCE VOLUME) from this snapshot.
- 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.
- Using the AWS Console:
- Attach SOURCE VOLUME to the new instance as /dev/xvdf.
- Attach TARGET VOLUME to the new instance as /dev/xvdg.
- SSH to the new instance and get root access:
- sudo su –
- Mount the source and target drives.
- mkdir -p /mnt/source && mount /dev/xvdf /mnt/source
- mkdir -p /mnt/target && mount /dev/xvdg1 /mnt/target
- Delete everything but /boot on the target volume:
- cd /mnt/target && ls | grep -v boot | xargs rm -Rf
- Delete /boot on the source volume:
- rm -Rf /mnt/source/boot
- Copy the source volume’s data to the target volume preserving all the attributes:
- rsync -aAXHPv /mnt/source/ /mnt/target
- Stop the system and detach all volumes using the AWS console. Attach the TARGET VOLUME on the new instance as /dev/xvda.
- 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.
- 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.