AWS, Cloud Computing, Tutorials

2 Mins Read

Steps to convert UBUNTU-BASED PV instances to HVM

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.

3. Install grub on it.

*Grub selects a specific kernel configuration available on a particular operating system’s partitions.

*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.

b. rsync is used for copying local files.

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.

d. chroot changes the root directory to that specified in path and then runs the command.

e. Grub modifications.

f. Update the grub changes, incase if the PV instance kernel version is not the same as HVM instance.

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

WRITTEN BY CloudThat

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.

SHARE

Comments

  1. Rick Provencio

    Jun 14, 2018

    Reply

    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!

  2. Sumant

    Mar 27, 2018

    Reply

    Worked perfectly! Thanks so much for this.

  3. Sohail Mohabbat Ali

    Feb 2, 2018

    Reply

    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.

  4. Aravinda Lokesh

    Jan 11, 2018

    Reply

    Thanks really, that worked!!

  5. Joe

    Aug 8, 2017

    Reply

    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.”

  6. n4j

    Mar 3, 2017

    Reply

    Worked for me. Thanks!!!!

  7. David

    Feb 4, 2017

    Reply

    Worked perfectly! Thanks so much for this.

  8. Graeme Pyle

    May 15, 2016

    Reply

    Man, thanks very much for this. It worked like a charm, and it will save me a lot in AWS fees going forward!

  9. Shrenik

    Sep 8, 2015

    Reply

    Thanks. This works like a breeze. Nice guide.

  10. Click to Comment

Get The Most Out Of Us

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!