0

Hi ServerFault Community.

To this volume group:

  --- Volume group ---
  VG Name               virtual-machines
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               117,18 GiB
  PE Size               4,00 MiB
  Total PE              29999
  Alloc PE / Size       25600 / 100,00 GiB
  Free  PE / Size       4399 / 17,18 GiB
  VG UUID               iXdHIW-f7eR-aAb2-DHxR-ybAv-dQCy-oBA1Um

containing this logical volume

  --- Logical volume ---
  LV Name                /dev/virtual-machines/win7x64
  VG Name                virtual-machines
  LV UUID                2CXriq-v3M2-dVkG-j8JI-dGUD-yyph-r9waRs
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                100,00 GiB
  Current LE             25600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

I'd like to add another logical volume via

lvcreate -L 100G -n win7x64-gaming virtual-machines

but it says

Insufficient free extents (4399) in volume group virtual-machines: 25600 required

So i thought of resizing the vg but I did not find anything like vgresize. How could I manage to add this new lv?

EDIT: I took an empty HDD and just called lvcreate so I assume the following is interesting for you.

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               virtual-machines
  PV Size               117,19 GiB / not usable 4,00 MiB
  Allocatable           yes 
  PE Size               4,00 MiB
  Total PE              29999
  Free PE               4399
  Allocated PE          25600
  PV UUID               iXZ9sf-UMnI-azYF-2h0v-dCt3-44GB-NwT7v9
lug
  • 41
  • 1
  • 8

1 Answers1

2

"but I did not find anything like vgresize" -> It does exists and it's named vgextend

Edit : If I guess correctly, You already have one disk /dev/sdb1, one vg called virtual-machines and one LV win7x64. Now you want to create another 100G LV but there is not enouch space, so you want to add another disk.

  • Step 1 : Identify the new disk. You can for example try dmesg.
  • Step 2 : Create a PV on the new disk (or on a partition of the new disk). Use pvcreate for this.

  • Step 3 : Add new PV to existing VG using vgextend

  • Step 4 : Create the new LV with your command above.
  • Doesn't this only work for physical volumes? – lug Aug 18 '12 at 13:10
  • What is your question? Vgextend lets you add physical volumes in existing vg. –  Aug 18 '12 at 13:28
  • added information to my question, maybe useful?! – lug Aug 18 '12 at 13:41
  • NO :( : "I took an empty HDD" -> what's its name? /dev/sdb1? Doesn't seem as it's not empty. I'll update the answer with what I guess. –  Aug 18 '12 at 13:47
  • /dev/sdb is the harddrive I want to add a new partition to the harddrive and then to the vg. – lug Aug 18 '12 at 13:56
  • /dev/sdb is not empty. Two options : A) Find/create unused partition on /dev/sdb B) Add an empty disk –  Aug 18 '12 at 14:01
  • take A ;) already created sdb2 – lug Aug 18 '12 at 14:02
  • couldn't i just enlarge the pv sdb1 so adding a new lv is no problem? – lug Aug 18 '12 at 14:03
  • then you finished step 1 and have to go to step 2 :) –  Aug 18 '12 at 14:04
  • thank you, that worked but now I just added another partition to my VG, right? couldn't I just extend the existing physical volume so that I don't have to add a new partition every time a add a new lv? – lug Aug 18 '12 at 15:45
  • 1
    Yes. Best is to use entire disk at the beginning. pvresize qnd fdisk can be used as a workaround afterward (as always, make sure you have backups before). –  Aug 18 '12 at 16:27