Extending a logical volume

I had extra space that no logical volume in my volume group was using.

Contents

Checking for extra space in VG

# vgdisplay vgroup
  --- Volume group ---
  VG Name               vgroup
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                7
  Open LV               7
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               74.41 GB
  PE Size               32.00 MB
  Total PE              2381
  Alloc PE / Size       2324 / 72.62 GB
  Free  PE / Size       57 / 1.78 GB
  VG UUID               [CUT]

We are interested in the Free PE / Size row.

Extending an LV

To view information on the LV:

# lvdisplay /dev/vg_belserver/home
  --- Logical volume ---
  LV Name                /dev/vgroup/home
  VG Name                vgroup
  LV UUID                [CUT]
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                20.00 GiB
  Current LE             640
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

Note: Just to be safe, I prefer to do this with the volume unmounted and in single user mode.

To extend using PE's available:

# lvextend -l +57 /dev/vgroup/home

Or extend by size:

# lvextend -L +10G /dev/vgroup/home

Or take a percentage of what's free:

# lvextend -l +75%FREE /dev/vgroup/home

Resizing filesystem

# resize2fs /dev/vgroup/home

Checking

# df -h