Xen Cloud Platform (XCP) – Add A Disk To The Default LVM Volume Group

image_pdfimage_print

If you initially install XCP using only one disk you can still add more drives later if you find you need more room. XCP uses LVM storage to manage the partitions created for new Virtual Machines which allows you to extend the default volume group at your leisure among other things.

In order to add a new disk to your default volume group perform the following steps.

Install the new drive into the computer

Partition it using fdisk

fdisk /dev/sdb

After you create the partition change it’s type to Linux LVM:

Enter the menu option T to change the partition type:

Enter the menu option 1 to choose the first partition:

Enter the menu item 8e to choose Linux LVM:

Enter the menu item p to print the partition output to verify that it is set to Linux LVM:

Enter the menu item w to save the partition information:

Enter the menu item q to quit:

Now we can add the partition to the volume group.

Set the partition as a physical volume:

pvcreate /dev/sdb1

Find out the name of the existing volume group:

pvdisplay

This should output something like this:

   --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               VG_XenStorage-be47438c-f310-dcf6-744e-651ba2bfaff9
  PV Size               457.76 GB / not usable 6.62 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              117183
  Free PE               96097
  Allocated PE          21086
  PV UUID               ZCI4EI-EURD-H5lK-VTlt-ZahV-itnl-bgMyiN

We are interested in this line:

VG Name          VG_XenStorage-be47438c-f310-dcf6-744e-651ba2bfaff9

Add the new physical volume to the existing volume group

vgextend /dev/VG_XenStorage-be47438c-f310-dcf6-744e-651ba2bfaff9 \
/dev/sdb1

Now you can verify that it worked by typing:

vgs

This should list the volume group and display it’s current size, which should indicate the size of the old volume group + the size of the added disk.