Resize of LVM partition is very easy in Unix , resize of LVM partition can be done without unmounting the the existing file system partition.
let’s assume that you have an ext3 partition lv_root which is mounted on / and a swap partition lv_root in a logical volume group vg_controller, now you are running out of space in /, there’s no space left in the above volume group but you have a brand new disk drive with lots of free space.
How to add some space to the / partition?
PV = Physical Volume
VG = Volume Group
LV = Logical Volume
WARNING: If you have important data in any directory under / then backup before attempting this.
Steps to increase or re-size the existing Linux partition using LVM ?
I’ll assume the spare disk is called /dev/sdb(108GB), make sure to switch to administrator (root)
[root@experts ~]# df -h
Filesystem Size Used Avail Use% Mounted on
50G 4.0G 43G 9% /
tmpfs 2.9G 224K 2.9G 1% /dev/shm
/dev/sda1 485M 56M 404M 13% /boot
245G 188M 233G 1% /home
know physical volumes..
[root@compute1 ~]# pvdisplay
know volume groups
[root@experts ~]# vgdisplay
know Logical Volume created and mapping
[root@experts ~]# lvdisplay
check disk attached status
[root@experts ~]#fdisk -l
Disk /dev/sdb: 108.4 GB, 108447924224 bytes
255 heads, 63 sectors/track, 13184 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×00000000
know Volume Group created
2. Create a new partition of appropriate size using fdisk and also change partition id.
[root@experts ~]#fdisk /dev/sdb
options m, n, p , partition cylinder default 1,Last Cyliner: +90G , p
option :t , select partition 2, L to list code :8e Linux LVM,
3.Create an ext3 file system in the partition this is required to make file system usable .
[root@experts ~]#mkfs.ext3 /dev/sdb2
4.Initialize the partition for use as a physical volume in lvm and add it to vg_controller
[root@experts ~]#pvcreate /dev/sdb2
[root@experts ~]#vgextend vg_controller /dev/sdb2
5.Extend lv_root (use ‘df -h’ to check that / is mounted on lv_root) as required (by 90G here)
# lvextend -L +90G /dev/vg_controller/lv_root
6.Finally, resize the filesystem (this part normally would require unmounting /, but for ext3 and 2.6 Kernels it works while the partition is mounted)
[root@experts ~]#resize2fs /dev/vg_controller/lv_root