LVM is a form of advanced partition management. Working with LVM, however, is one of the more complex topics to understand the first time you deal with it. After you have some practice, you will find that LVM just makes life easier.
Now, I'll give you some tips to begin with LVM.
Verify that required packages is installed: without this package, you are unable to use LVM on your system.
View the physical volumes, use the pvs and pvdisplay command:
View information about the volume group, use the vgs and vgdisplay command:
View the logical volumes, use lvs and lvdisplay command:
By now, you should be able to view all the information available about LVM. You can also look in the /etc/lvm directory, which contains all the information about each layer of the LVM structure. LVM has two such units: physical extents and logical extents. To create an LVM Partition, first, you need to initialize the
disk to be used for a physical volume.
1- Initialize and verify the disk, use pvcreate and pvdisplay command:
2- Create and verify volume group, use the vgcreate and vgdisplay command:
3- Create a partition 3GB in size:
Alternatively, you can use
lvextend, lvresize command
4- Create a new physical volume and extend volume group to incorporate the new one:
5- Reduce the physical volume from volume group:
6- Migration Data from one disk to another, even while the disk is online!
7- Deleting an LVM Partition: it's a common task when you are upgrading or redesigning a file system layout.
8- Setting up Raid 5: let's use three disks (sdb, sdc, sdd) to set up a RAID array. First, we have to create three partitions, one on each disk, allowing each partition to consume the whole disk.
9- In case of disk fails
Have fun!