- Consulting
- Training
- Partners
- About Us
x
My previous blog will help you convert Rhel-based PV instances to HVM.
In this blog, we will convert Ubuntu based PV instances to HVM.
1. Start a new Ubuntu HVM machine.
2. Start a Ubuntu PV machine from your existing AMI.
(or)
If you are just testing then, install any simple package on it for instance, Apache.
1 |
sudo apt-get update |
1 |
sudo apt-get install apache2 |
3. Install grub on it.
*Grub selects a specific kernel configuration available on a particular operating system’s partitions.
1 |
apt-get install grub-pc grub-pc-bin grub-legacy-ec2 grub-gfxpayload-lists |
*Note: If you are just testing, then you can open the public DNS of your instance in a new tab of your browser and you will see the default Ubuntu 14.04 Apache web page.
4. Stop PV instance.
5. Detach the root volume (/dev/sda1) from PV instance.
6. Attach the root volume of PV instance to the running HVM instance. For example, /dev/sdf.
7. Login to your HVM instance and execute the following commands.
*Note: You need to be root user to execute these commands : sudo su.
a.
1 |
mkdir -p /mnt/xvdf && mount /dev/xvdf /mnt/xvdf |
b. rsync is used for copying local files.
1 |
rsync -avzXA /boot/ /mnt/xvdf/boot/ |
c. Make sure you specify the correct order of the file systems to be mounted when you are using bind option of the mount command.
1 |
mount -o bind /dev /mnt/xvdf/dev && mount -o bind /dev/pts /mnt/xvdf/dev/pts && mount -o bind /proc /mnt/xvdf/proc && mount -o bind /sys /mnt/xvdf/sys |
d. chroot changes the root directory to that specified in path and then runs the command.
1 |
chroot /mnt/xvdf |
e. Grub modifications.
1 |
grub-install --no-floppy --recheck --force /dev/xvdf |
f. Update the grub changes, incase if the PV instance kernel version is not the same as HVM instance.
1 |
update-grub2 |
g. Exit chroot: CTRL+D.
8. Stop the HVM instance.
9. Detach both the volumes:
/dev/sda1 original root AND detach /dev/sdf PVM root.
10. Attach the PV root volume to HVM instance as /dev/sda1.
11. Start the HVM instance. Start the instance using AWS console. The HVM instance should now boot successfully and will be an exact copy of the old source PV instance (if you used the correct volume). Once you have confirmed that everything is working, the source instance can be stopped. Cleanup by removing all temporary volumes (source and destination).
*Note: If you are testing it out, then, you can open the public DNS of your instance in a new tab of your browser and you will see the default Ubuntu 14.04 Apache web page.
12. Create an AMI from the running HVM instance, this will be HVM virtualized.
Voiced by Amazon Polly |
CloudThat is a leading provider of cloud training and consulting services, empowering individuals and organizations to leverage the full potential of cloud computing. With a commitment to delivering cutting-edge expertise, CloudThat equips professionals with the skills needed to thrive in the digital era.
Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!
Rick Provencio
Jun 14, 2018
My issue with this method is that my volumes show as “nmve0n1” which I think is the sda1 and “nvme1n1” also might be the sdf volume. I don’t know how to proceed with step 7 because there isn’t a /dev/xvdf directory with anything inside. Any help would be appreciated, thanks!
Sumant
Mar 27, 2018
Worked perfectly! Thanks so much for this.
Sohail Mohabbat Ali
Feb 2, 2018
Perfect, worked like a charm. After meltdown and spectre problems amazon is recommending to migrate instances from PV to HVM virtualization and this article helped me a lot.
Aravinda Lokesh
Jan 11, 2018
Thanks really, that worked!!
Joe
Aug 8, 2017
Are there specific criteria for the HVM AMI you choose? I can’t attach any PV volumes to my HVM instance. I get this error: “Error attaching volume: The instance configuration for this AWS Marketplace product is not supported. Please see the AWS Marketplace site for more information about supported instance types, regions, and operating systems.”
n4j
Mar 3, 2017
Worked for me. Thanks!!!!
David
Feb 4, 2017
Worked perfectly! Thanks so much for this.
Graeme Pyle
May 15, 2016
Man, thanks very much for this. It worked like a charm, and it will save me a lot in AWS fees going forward!
Shrenik
Sep 8, 2015
Thanks. This works like a breeze. Nice guide.
Click to Comment