LVM Configuration in RHEL5
partition, which has been created is fixed in size. LVM (Logical Volume Manager) configuration is used to extend the partition.
Create partition
#fdisk -l
#fdisk /dev/sda
:n // n means new partition creation
:l // l means logical partition
+500M
:t ( toggle ‘t’ convert one partition to another)
LVM conversion code: 8e // for linux LVM
:w // save
#partprobe | sync
creating physical volume, PV- Physical Volume
Here sda8 is the partition, which is create by above step
#pvcreate /dev/sda8
Creating volume group, VG – Volume Group
#vgcreate vol /dev/sda8
Allocating space for LVM “vol” group
#lvcreate -L 100M -n lvm /dev/vol
Formatting the volume with ext3 file system, after formatting only partition will be used.
#mkfs.ext3 /dev/vol/lvm
Creating directory “test” and /dev/vol/lvm LVM partition have to be mounted in “test”
#mkdir /test
#mount /dev/vol/lvm /test
NOTE: Make a permanent mount in /etc/fstab
Extending the LVM partition size
#lvextend -L +200M /dev/vol/lvm
Command resize2fs only resize(extend) the partition
#resize2fs /dev/vol/lvm
Reduce the LVM partition size
#lvreduce -L +200M /dev/vol/lvm
Command resize2fs only resize(reduce) the partition
#resize2fs /dev/vol/lvm
To display logical volume
#lxdisplay /dev/vol/lvm
To remove lvm
#umount /test
#lvremove /dev/vol/lvm
To remove group
#vgremove /dev/vol
To change groupname
#vgchange -an /dev/vol




