Openstack increase volume capacity

Posted: May 23, 2014 in Uncategorized
Tags: ,

If you have installed Openstack using DevStack, you will be able to create volumes or volume snapshots only until total capacity reaches 10GB. You won’t be able to create volumes larger than 10GB and you won’t be able to create more volumes when it reahes 10GB.

This article guides you how to increase this volume capacity so you can create more and larger volumes.

View the volume groups by executing “vgs” command. You can see that volume group “stack-volumes” is 10GB in size. So only volumes can be created upto 10GB.

 $vgs
  VG            #PV #LV #SN Attr   VSize   VFree
  stack-volumes   3   1   0 wz--n-  10.00g 10.00g
  stratos1        1   2   0 wz--n- 931.09g 48.00m

Let’s create a new partition so that we can increase the capacity of the volume group. A file named “cinder-volumes” which has the size of 50GB is created. The file is associated to the loop device /dev/loop3. Then the device is partitioned using fdisk.

dd if=/dev/zero of=cinder-volumes bs=1 count=0 seek=50G
losetup /dev/loop3 cinder-volumes
fdisk /dev/loop3

And at the fdisk prompt, enter the following commands:

n
p
1
ENTER
ENTER
t
8e
w

Create a physical volume with the above device.

root@stratos1:~# pvcreate /dev/loop3
  Physical volume "/dev/loop3" successfully created

Exetend the volume group (stack-volumes) size by adding the newly created device.

root@stratos1:~# vgextend stack-volumes  /dev/loop3
  Volume group "stack-volumes" successfully extended

Let’s see the details about the available physical devices. You will see the new device listed down.

root@stratos1:~# pvs
  PV         VG            Fmt  Attr PSize   PFree
  /dev/loop0 stack-volumes lvm2 a-    10.01g 10.01g
  /dev/loop3 stack-volumes lvm2 a-    50.00g 50.00g

Now check the details of the volumes groups by executing the vgdisplay command. You will see there are more free space (60GB since we added 50GB more) in the volume group “stack-volumes”.

root@stratos1:~# vgdisplay
  --- Volume group ---
  VG Name               stack-volumes
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  303
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               60.00 GiB
  PE Size               4.00 MiB
  Total PE              23040
  Alloc PE / Size       7680 / 30.00 GiB
  Free  PE / Size       15360 / 60.00 GiB
  VG UUID               bM4X5R-hC3V-zY5F-ZMVI-s7dz-Kpiu-tPQ2Zt

Now you will be able to create more and larger volumes.

Comments
  1. Roberto says:

    this not work for encryption!
    You have to re-deploy Devstack with new row in local.conf like:
    VOLUME_BACKING_FILE_SIZE=50000M
    if you want encryption for Cinder

  2. Hi Roberto,
    Thank you very much for your feedback. Could you please explain more the issue you have mentioned.

  3. Tim Sorber says:

    To create the Physical Volume in the “pvcreate” step above, I had to first edit the /etc/lvm/lvm.conf file to add the new “loop” device or the system. The system returned this error message “Device /dev/loop2 not found (or ignored by filtering).” In my case, using loop2, I inserted ‘, “a|loop2|”‘ after the entry for loop1. This opens the filter. There may be other fixes, but this one worked for me with Ubuntu 14.04.03.

    Great post, thanks!

  4. Yunus Shaikh says:

    Thanks a lot it worked for me

  5. ishman says:

    Hi –

    I was able to successfully add the extra volume as shown below (200 GB) but am still getting am getting an error when I try to create a volume of 100 GB from Horizon. Which logs can I please check to debug ? And do I have to restart any process for this to take effect ?

    [root@testcloud~]# pvs
    PV VG Fmt Attr PSize PFree
    /dev/loop3 rhel lvm2 a– 200.00g 200.00g
    /dev/sda2 rhel lvm2 a– 930.51g 0

    [root@testcloud ~]# vgdisplay
    — Volume group —
    VG Name rhel
    System ID
    Format lvm2
    Metadata Areas 2
    Metadata Sequence No 4
    VG Access read/write
    VG Status resizable
    MAX LV 0
    Cur LV 2
    Open LV 2
    Max PV 0
    Cur PV 2
    Act PV 2
    VG Size 1.10 TiB
    PE Size 4.00 MiB
    Total PE 289409
    Alloc PE / Size 238210 / 930.51 GiB
    Free PE / Size 51199 / 200.00 GiB
    VG UUID 6WrGOc-fTd8-2f4f-aR1q-fcVN-QaTZ-gIFMyo

  6. rajeshwerrao madoori says:

    Volume group “stack-volumes” not found

  7. Keith E Fleming says:

    I know this is old, but THANK YOU for this. I found it very helpful!

  8. Gaurav says:

    Hi,

    With the steps given I am able to extend the size. But after reboot the PV goes in unknow state. Do we need to do anything to make it persistant on reboot.

  9. Tim Sorber says:

    With DevStack, you must reassign the loop devices using losetup before you restart the openstack services. DevStack does not like to persist after a reboot. Do not rerun the stack.sh or it will reset the the the backing file and possibly delete data. After you rerun the losetup command. then run rejoin-stack.sh (https://github.com/cloudbuilders/devstack/blob/master/rejoin-stack.sh) to restart the services. you must assume the proper userid and be in the devstack subdirectory when running rejoin-stack.sh

Leave a reply to Udara S.S Liyanage Cancel reply