Tips & How-To's

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

— Extend the VG
sudo vgextend mesa-nl-vg /dev/xvdc1

— Extend LV. Note that the +100G indicates the size by which it should be increased
sudo lvextend -L+100G /dev/mapper/mesa--nl--vg-root

— Resize the filesystem
sudo resize2fs /dev/mapper/mesa--nl--vg-root

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

One Comment

  1. That certainly all makes sense. And it sounds like a lot of fun too. Kind of like the thrills I get when I vacation in Sin City and use the services of Vegas Fantasy Babes at https://vegasfantasybabes.com. Trust me when I say there’s nothing better than an evening with a gorgeous escort. A woman like that knows how to show you around town and make your trip memorable.

Leave a Reply

Your email address will not be published. Required fields are marked *