Xenserver and adding/attaching a new storage to a VM

I had an instance today where a local VM(which is provisioned by Xenserver) was running low on disk space and wanted to increase the disk space allocated to it. Last time when I did it by increasing the space from within Xen Manager, I failed miserably(the VM was configured with LVM and neither pvscan or lvscan was able to see the increased space).

This time I tried a different approach:

  • rather than increasing the space of the attached disk, I created a new disk and attach it to the VM from Xenserver Management Console
  • Since the VM is configured with LVM, I decided to add the new disk as a Physical Volume(PV) and then extend the Logical Volume(LV) & Volume Group(VG)

Creating a new disk and attaching it to the VM from Xenserver management Console is fairly straightforward. First make note of the device to which the new disk is attached to. In this case, it is assumed to be xvdc. I'm also assuming that the volume group mesa-nl-vg exists and /dev/mapper/mesa–nl–vg–root is the logical volume path

Here's the steps ahead

` — Create new partition sudo fdisk /dev/xvdc — Create a new PV sudo pvcreate /dev/xvdc1

HowToGeek has a nice writeup & cheatsheet on LVM, you should read that to get you up to speed with LVM.