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
partprobeTo notify kernel about the change in device
pvcreateTo create physical volume
pvdisplayTo display the size and other information about physical volume
pvremoveTo remove the physical volume
pvresizeTo modify the size of physical volume
pvscanTo scan the physical volume
vgextendto extend the size of volume group
vgreduceto reduce the size of volume group
vgscanto scan the volume group for change
vgdisplayto display the status and information about volume group
lvdisplaywill display the status of lvm
lvreduceto reduce the size of lvm
lvextendto extend the size of lvm
lvcreateto create the lvm
lvremoveto remove the lvm partition
lvscanto scan lvm for change
fdisk-lTo show the current partition status of hard disk
fdisk/dev/sdaTo invoke fdisk utility on /dev/sda
nto create new partition
tto define file types
dto delete partitions
wto save change