SWAT Blog

Extend and Remove the Logical Volume (LVM)

February 12th, 2013 by Bhagwan Dass

Advantage of LVM is that we can Extend Reduce or Remove volumes any time.

Extend logical volume:-

Here we extend 500MB in Logical Volume lv0

[root@localhost ~]#lvextend -L +500 /dev/vg0/lv0

Extending logical volume lv0 to 1.49 GiB
Logical volume lv0 successfully resized

[root@localhost ~]#resize2fs /dev/vg0/lv0

resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg0/lv0 is mounted on /lvm-disk; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg0/lv0 to 390144 (4k) blocks.
The filesystem on /dev/vg0/lv0 is now 390144 blocks long.

Remove logical volume:-
Make sure the volume is unmounted and no data in logical volume:-

[root@localhost lvm-disk]# lvdisplay

— Logical volume —
LV Path /dev/vg0/lv0
LV Name lv0
VG Name vg0
LV UUID 5oGJ4c-In6O-gJsl-2bT1-QLNV-f5sw-wHwswe
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-02-11 14:14:00 +0530
LV Status available
# open 0
LV Size 500.00 MiB
Current LE 125
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0

— Logical volume —
LV Path /dev/vg0/lv1
LV Name lv1
VG Name vg0
LV UUID 835410-RrAU-EMCK-qSL2-GsPC-3AR7-goalKl
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-02-12 09:44:42 +0530
LV Status available
# open 0
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:1

[root@localhost lvm-disk]# lvremove /dev/vg0/lv0

Do you really want to remove active logical volume lv0? [y/n]: y
Logical volume “lv0″ successfully removed

[root@localhost lvm-disk]# lvdisplay

— Logical volume —
LV Path /dev/vg0/lv1
LV Name lv1
VG Name vg0
LV UUID 835410-RrAU-EMCK-qSL2-GsPC-3AR7-goalKl
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-02-12 09:44:42 +0530
LV Status available
# open 1
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:1

Done…

Leave a Reply

  • © 2004-2015 Special Work & Technology Limited