Sunday, November 13, 2016

Adding New Disk to Linux VM running on Nutanix AHV (Part-1: Extending Current Volume group and Logical Volume)


In this post, I will go through the Steps to Add a New Disk to Linux VM running on Nutanix AHV,
In my example, I have Oracle Linux 6.5 VM running with one assigned disk with 100 GB and we want to add another disk with 350 GB, first let’s check the status of the available Volumes with the command “pvscan”
Note that you have only one Volume with 100 GB

Now let’s List all available disk Partitions by running the command: Ls /dev/sd*
The command will list all available hard disks


Now I will add a new disk to the Virtual machine, this is done from the Nutanix Prism portal, go to VM menu and then select the VM, then Click on the update button
As you can see we have only one SCSI disk with 100 GB which is the OS disk, now we will add a new disk

From the Add Disk window we can chose the bus type and in our case, we will choose SCSI,
We will add 350 GB as the disk size,

Now the disk has been added and provided to the Virtual machine,

Do you think the disk will be shown and become available to use with only add it from the Hypervisor level?
Answer is NO J , we need to do lots of stuff to partition, format and make the disk ready to be used,
First thing lets List all available disks by running the command again: Ls /dev/sd*
You will notice some changes, the new added disk is now listed,

Let’s run the command: echo "- - -" > /sys/class/scsi_host/host0/scan
This command will avoid the reboot you may need to rescan your newly added Storage Interconnect,

For host1 and host2

Now let’s partition the new disk (/dev/sdb) and this can be done using the command: FDISK

Type “n” and press enter to add a new partition

Type “P” and press enter to make the Partition Primary

We don’t have any partitions yet in this disk, so I will give this partition number “1” and press enter

Choose default value of the first Cylinders (Default 1) Just press enter

Choose default value of the last Cylinders (Default 2610) Just press enter

Type “t” and press enter to change the partition system ID, as we have only one partition “1” it will be selected without any prompt to choose,

Type “8e” and press enter to change the system type to Linux LVM partition and press enter

Type “w” and press enter to write the changes we made to the disk and exit

Using the command “pvcreate” we will create a physical Volume pointing to our new partition /dev/sdb1

Type “vgdisplay” and press enter to confirm the name of the current volume group, in our setup here the name is “VolGroup

Type “vgextend VolGroup /dev/sdb1” and press enter to extend the current volume group “VolGroup” with adding the new physical volume “/dev/sdb1

Type “pvscan” and press enter to scan all available disks physical volumes,
Our new added disk is now listed

Now Lets Extend the Logical Volume with "lvextend"


In the next post : Part-2: Creating new Volume group and new Logical Volume
we will go through the process of adding a new disk but we will create a new Volume Group and we will have a new Logical Volume group mounting to a new mounting point,








No comments:

Post a Comment