Wednesday, December 4, 2013

[CC] resize hard disk by expanding the capacity of a CloudStack 4.2 virtual machine in XenServer 6.2

Often in a given scenario of use case, the practitioner would perform some capacity planning and cater for the computing resources needed at a slightly higher amount, to give some buffer or leeway. However, we might run to an event where the computing resources is over subscribed. In the setup of the management server for CloudStack 4.2, we might run to an event that requires the engineer to increase the hard disk capacity for both the primary and secondary storage. Assuming having to physical access to the physical blade servers, adding more hard disk capacity can be as simple as plugging more hard disks. provisioning gets complicated when storage is virtualized, and with the virtual machine created in the hypervisor with XenServer 6.2.

The following steps are necessary to resize by increasing the hard disk capacity of a virtual machine residing in XenServer 6.2 as the hypervisor.

First, power off the VM. I like to create a backup of my VM before I perform anything drastic. At such, any awkward situation that requires a save, the backup is to the rescue. To resize hard disk of the VM, From XenCenter, select the corresponding VM and click properties. Change the size of the hard disk accordingly. Here the size is increased to 28GB.

Then, restart the corresponding VM. From here, we will be using the "fdisk" commands on centos6 to manipulate the VM's resources.

Take a look of the VM's hard disk with "fdisk -l" or "fdisk /dev/xvda"

Observe the total capacity of this newly resize hard disk, and also the location of the device created. note that in centos6, /dev/xvda2 is not automatically resize to the new capacity.
The trick here is to create a new primary partition called "/dev/xvda3", and then allocate the subsequent capacity form 1046 onwards to 30064771072. All these can be done with the "fdisk suite of command". use the "m" for the menu of the fdisk.

After creating the new partition, verify the new partition. All these are not done yet. The partition tables need to be written out.

This is not the end of resizing the hard disk for a VM in XenServer 6.2 hypervisor yet.

The unique-ness of centos6 as compared to ubuntu when it comes to disk management, centos6 requires the linux volume group "VolGroup" to be extended with the new physical device "/dev/xvda3". then the centos6 "home" folder that is residing at "/dev/VolGroup/lv_root" need to be extended with the newly acquired physical volume.

note the +20G parameter used caused some errors, because of insufficient disk blocks.

That is not the end of it yet. The file system is not updated with the latest disk capacity and need to be resized with command "resize2fs".

A final check to ensure the newly created hard disk capacity is available.

No comments: