Thursday, November 15, 2012

How to Extend LVM linux RedHat 6

Here are steps to extend and reduse LVM in Linux Redhat 6

1. Check sizing Volume group that filesystem want to changes

[root@RedHat6]# uname -sr Linux 2.6.32-71.el6.x86_64
[root@RedHat6]# vgs
VG #PV #LV #SN Attr VSize VFree
vg00 1 1 0 wz--n- 1020.00m 0
vgVo 1 1 0 wz--n- 3.41g 0
 vg_arch 1 1 0 wz--n- 1.95g 972.00m 
vgswap 1 1 0 wz--n- 508.00m 0
[root@RedHat6]#


[root@RedHat6]# vgdisplay vg_arch
  --- Volume group ---
  VG Name               vg_arch
  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               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.95 GiB
  PE Size               4.00 MiB
  Total PE              499
  Alloc PE / Size       256 / 1.00 GiB
  Free  PE / Size       243 / 972.00 MiB
  VG UUID               qjyTfj-UMKx-uFDo-L1BE-xf4t-cD9O-myqJC3
[root@RedHat6]#

2. Ok, we have 972Mb free size on vg_arch and then we can add that to filesystem oravl99

[root@RedHat6]# lvs
  LV      VG      Attr   LSize    Origin Snap%  Move Log Copy%  Convert
  prod    vg00    -wi-ao 1020.00m
  lvVo    vgVo    -wi-ao    3.41g
  oravl99 vg_arch -wi-ao    1.00g
  LSWAP   vgswap  -wi-ao  508.00m
[root@RedHat6


[root@RedHat6]# lvextend -l +243 /dev/vg_arch/oravl9
Extending logical volume oravl99 to 1.95 GiB
Logical volume oravl99 successfully resized
[root@RedHat6]

===== OR we can use below command =========
[root@RedHat6]# lvextend -L +972M /dev/vg_arch/oravl99
  Extending logical volume oravl99 to 1.95 GiB
  Logical volume oravl99 successfully resized
[root@RedHat6]#
====================================

[root@RedHat6]# lvs
LV      VG      Attr   LSize    Origin Snap%  Move Log Copy%  Convert
prod    vg00    -wi-ao 1020.00m
lvVo    vgVo    -wi-ao    3.41g
oravl99 vg_arch -wi-ao    1.95g
LSWAP   vgswap  -wi-ao  508.00m
[root@RedHat6]

3. resizing filesystem oravl99

[root@RedHat6]# resize2fs /dev/vg_arch/oravl99
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_arch/oravl99 is mounted on /oravl99; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg_arch/oravl99 to 510976 (4k) blocks.
The filesystem on /dev/vg_arch/oravl99 is now 510976 blocks long.

[root@RedHat6]# df -h /oravl99
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_arch-oravl99
                      2.0G   34M  1.8G   2% /oravl99
[root@RedHat6]#

4. Done

0 komentar:

Post a Comment

 
footer