Monday, May 25, 2015

Extending an LVM volume in Linux 6

 

Extending an LVM volume in Linux 6:

Storage Layers : Physical volumes (partitions) -> Volume groups -> Logical volume -> Filesystem

Logical Volumes are allocated/extended within the boundaries of their underlying storage pool which is called a Volume Group in LVM terminology. 

 
  • addto VMWare a new virtual hard disk 

  • as root user  
    •  check the newly added disks

# ls /dev/sd*

/dev/sda /dev/sda1 /dev/sda2 /dev/sdb

note that the new disk is : sdb

check Volume Group name:
 
# vgdisplay
 
 --- Volume group ---
  VG Name               vg_linux6
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               18.14 GiB
  PE Size               4.00 MiB
  Total PE              4645
  Alloc PE / Size       4480 / 17.50 GiB
  Free  PE / Size       00 / 00.00 MiB
  VG UUID               IwaFL0-QCi8-iIUE-TWjQ-R906-PYpH-gMPaH9
 
partition to the Volume Group:
# pvcreate /dev/sdb 
 
# vgextend vg_linux6 /dev/sdb
 
check the new free size 
 
#vgdisplay
 
 
After you've extended the Volume Group, you are free to extend the Logical Volume:

# lvdisplay

--- Logical volume ---
  LV Path                /dev/vg_linux6/LogVol01
  LV Name              LogVol00 
 VG Name              vg_linux6
  LV size         4.0 GB
..............
  LV Path                /dev/vg_linux6/LogVol01
  LV Name              LogVol01
  VG Name              vg_linux6
  LV size         16.0 GB
  
decide witch LV you want to extend then :
 
# lvextend -L+10G /dev/vg_linux6/LogVol01
 
note : 10G is the size of disk sdb
 

# resize2fs /dev/vg_linux6/LogVol01
 
check the new size of LV
 
# lvdisplay 

No comments:

Post a Comment