3

I increased the provisioned size in the Vsphere client to 32GB and I used gparted to resize the VG to 32GB

  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg_proxy
  PV Size               31.51 GiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              8066
  Free PE               3072
  Allocated PE          4994

But I'm unsure on how to resize the LV and not lose data.

  --- Logical volume ---
  LV Path                /dev/vg_proxy/lv_root
  LV Name                lv_root
  VG Name                vg_proxy
  LV UUID                h9c0HO-xRQn-jX6q-4GGi-0nkt-2rnt-DNy3gR
  LV Write Access        read/write
  LV Creation host, time proxy, 2013-12-23 15:23:20 -0800
  LV Status              available
  # open                 1
  LV Size                17.51 GiB
  Current LE             4482
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto 


  - currently set to     256

How can I resize my logical volume?

Stefan Lasiewski
  • 22,949
  • 38
  • 129
  • 184
the dave
  • 73
  • 1
  • 2
  • 9

1 Answers1

8

Growing a volume would almost never result in data loss. It is extremely reliable. (But, you do have recently verified backups, don't you? There is never a guarantee.)

To grow to all of your available space:

lvresize -rl +100%FREE /dev/vg_proxy/lv_root

Or, to grow to an absolute/relative value:

lvresize -rL 30G /dev/vg_proxy/lv_root
lvresize -rL +5G /dev/vg_proxy/lv_root

The meaning is somewhat different. But, this is how I usually use the two options. You can read more in the man page.

-l, --extents [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}] Change or set the logical volume size in units of logical extents. With the + or - sign the value is added to or subtracted from the actual size of the logical volume and without it, the value is taken as an absolute one. The number can also be expressed as a percentage of the total space in the Volume Group with the suffix %VG, relative to the existing size of the Logical Volume with the suffix %LV, as a percentage of the remaining free space of the PhysicalVolumes on the command line with the suffix %PVS, as a percentage of the remaining free space in the Volume Group with the suffix %FREE, or (for a snapshot) as a percentage of the total space in the Origin Logical Volume with the suffix %ORIGIN. The resulting value is rounded downward for the substraction otherwise it is rounded upward.

-L, --size [+|-]LogicalVolumeSize[bBsSkKmMgGtTpPeE] Change or set the logical volume size in units of megabytes. A size suffix of M for megabytes, G for gigabytes, T for terabytes, P for petabytes or E for exabytes is optional. With the + or - sign the value is added or subtracted from the actual size of the logical volume and rounded to the full extent size and without it, the value is taken as an absolute one.

man lvresize

Aaron Copley
  • 12,345
  • 5
  • 46
  • 67
  • Great, well that did an online resize of the LV and FS resulting in the free diskspace I was looking for. Now I have a quirk, I'm using Webmin and it seems to show the LV in two groups, is this because of the way the actual blocks are allocated/distributed? `Allocation by logical volumes lv_root 17.51 GB lv_swap 2 GB lv_root 12 GB ` – the dave Feb 12 '14 at 01:26
  • I don't think so. That sounds like some Webmin weirdness.. What do you see on the CLI? (`lvdisplay` or `lvs`) LVM is supposed to provide for a layer of abstraction to make how the space is allocated transparent. Did you grow by 12GB? – Aaron Copley Feb 15 '14 at 16:21