Disk managements

In our previous article we have learned how to create lvm partition and mount them permanently in /etc/fstab .
before going with advance lvm management. In this tutorial guide we will learn about advance lvm management. In our pervious article we have created two lvm partitions. Now we will manage them. First we will extend the size of lv00 our first lvm partition.

Check all these partition are functioning properly

Check the current size of lv00

lvdisplay linux command for displaying lvm

As you can see the current size of lv00 is 100MB. To extend it with 50MB space run these commands

lvm extend

Now we will reduce the size of 20MB from lvm partition.
If you have free space in lvm partition no data lose will happen. Lose in data will happen only when partition is full.
lvm reduce

at this moment you should be able to extend and reduce the size of lvm partition now we will remove these partitions
lvremove linux lvm command

don't forget to remove these partitions form /etc/fstab also

/etc/fstab

now use fdisk command to delete these partition form hard disk

#fdisk /dev/sda

fdisk

run partprobe command to tell kernel about change and verify it

lvm

Do these practical of lvm as much as you can as RHCE is performance based exam and none of us will want to retake it. We have summarized all important commands in a single table cram it.

Command Description
partprobe To notify kernel about the change in device
pvcreate To create physical volume
pvdisplay To display the size and other information about physical volume
pvremove To remove the physical volume
pvresize To modify the size of physical volume
pvscan To scan the physical volume
vgextend to extend the size of volume group
vgreduce to reduce the size of volume group
vgscan to scan the volume group for change
vgdisplay to display the status and information about volume group
lvdisplay will display the status of lvm
lvreduce to reduce the size of lvm
lvextend to extend the size of lvm
lvcreate to create the lvm
lvremove to remove the lvm partition
lvscan to scan lvm for change
fdisk -l To show the current partition status of hard disk
fdisk /dev/sda To invoke fdisk utility on /dev/sda
n to create new partition
t to define file types
d to delete partitions
w to save change