Steps to convert RHEL – Based PV instances to HVM

You can read my previous blog to learn why HVM instances in AWS work better than PV instances. Also, why HVM instances are preferred over PV instances. Amazon offers HVM instances at a fraction of the cost of the PV ones. For example, HVM m3.medium is $0.087 per hour, while PV m1.medium is $0.087 per hour. Despite the lower price, HVM m3.medium offers more cores and memory. You should convert a PV machine to HVM. It is cheaper and the PV instances may eventually retire.
These are the steps:
These steps are only for RHEL-based PV instances such as Amazon Linux, CentOS and RedHat.
1. Login to your account (SSH).
2. Put grub on it.
*Grub selects the kernel configuration that is available on a particular operating systems’ partitions.
sudo yum -y1sudo: yum -y3 Stop the instance and take a snapshot of the root volume.
*You can also create an image of your instance to overcome any downtime and launch another machine.
4. Start an Amazon Linux “working” instance (PV), and log in to that instance.
ssh -i path-to-your-pem-file.pem [email protected] -i path-to-your-pem-file.pem [email protected]. Attach the new’source volume’ (in the same location as the snapshot created in Step 3), to the ‘working instance as /dev/xvdf. This volume can be as large or smaller than the source instance (Step 1), or even increased.
6. Create a new volume called ‘destination’ in the same AZ as the snapshot created in step 3. Attach it to the working’ instance with the following: /dev/xvdo
7. Next, we divide the destination volume.
a. Partitioning the destination volume is done using parted
*Parted is a program that creates and manipulates partition tables.
sudo parted /dev/xvdo –script ‘mklabel msdos mkpart primary 1M -1s print quit’1sudo parted /dev/xvdo –script ‘mklabel msdos mkpart primary 1M -1s print quit’Output:
Model: Xen Virtual Block Device (xvd)Disk /dev/xvdo: 8590MBSector size (logical/physical): 512B/512BPartition Table: msdosNumber Start End Size Type File system Flags1 1049kB 8590MB 8589MB primary1234567891011Model: Xen Virtual Block Device (xvd)Disk /dev/xvdo: 8590MBSector size (logical/physical): 512B/512BPartition Table: msdosNumber Start End Size Type File system Flags1 1049kB 8590MB 8589MB primaryb. The OS kernel checks the destination volume’s partition table and updates it.
*partprobe informs the operating-system kernel about partition table changes by asking that the operating-system re-read the partition tables.
sudo partprobe /dev/xvdo1 sudo partprobe /dev/xvdoc. Update the destination information.
*udevadm settlement waits for the udevd device creation events to be processed. This ensures that all device nodes have been successfully created before proceeding.
udevadm settle1 udevadm settle8. The’source volume’ should be checked.
A. e2fsck can be used to verify a Linux second extended system.
sudo e2fsck -f /dev/xvdf1 sudo e2fsck -f /dev/xvdfOutput:
e2fsck 1.42.8 (4-Nov-2014)Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary information/: 39159/524288 files (0.3% non-contiguous), 366426/2097152 blocks12345678910111213e2fsck 1.42.8 (4-Nov-2014)Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary information/: 39159/524288 files (0.3% non-contiguous), 366426/2097152 blocksb. To speed up the process and eliminate coauthoring, reduce the filesystem’s size.