Steps to convert UBUNTU-BASED PV instances to HVM

December 5, 2014 | Comments(5) |

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.


5 Responses to “Steps to convert UBUNTU-BASED PV instances to HVM”

  1. Graeme Pyle

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

    Reply
  2. Joe

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

    Reply

Leave a Reply