The Linux Logical Volume Manager (LVM) is a mechanism to virtualize the disks.
It can create "virtual" disk partitions out of one or more physical hard drives, allowing you to grow, shrink, or move those partitions from drive to drive as your needs change.
It also allows you to create larger partitions than you could achieve with a single drive.
Creating a Physical Volume (PV)
Create a partition using fdisk, and change the hex code of it to 8e.
Save and exit the fdisk and update the partition table using partx -a command
Create a PV on newly created partition i.e. /dev/sdax.
Verify it by pvs or pvdisplay command
Syntax: #pvcreate partition name
#pvcreate /dev/sdax
To see the details of a particular PV, use the command
#pvdisplay partition name
Creating a Volume Group (VG)
After creating a PV, the next step is to create a Volume Group or VG
To create a VG the syntax is
#vgcreate name for the VG partition name
#vgcreate myvg /dev/sdax
Once we are ready with a Volume Group then it’s the time to create a Logical Volume LV
The syntax for creating an LV is
#lvcreate -L size of LV -n name for LV VG name
#lvcreate -L 300M -n mylv myvg (To create a LV of 200MB)
As per now we have our VG created so is our LV. In order make it accessible we need to format it with a file system like ext4 or ext3 or vfat.
The syntax for formatting an LV is exactly like formatting a normal partition, Instead of /dev/partition name we use the path of LV that will be something like /dev/vg/lv
#mkfs.ext4 m/dev/yvg/mylv
Mounting an LV is exactly same like a normal partition, again the path for mounting will be /dev/vg/lv
Create a directory over which the LV should be mounted.
#mount /dev/vgname/lvname /directory name
#mount /dev/myvg/mylv /hyd
Verify the mounting with mount command
Make it a permanent mount by making an entry in /etc/fstab
Watch video How to create and extend a Logical Volume (LV)? LVM in linux(RHEL 6) part 1 online, duration hours minute second in high quality that is uploaded to the channel Red hat Linux Training for beginners 06 July 2020. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 380 times and liked it 13 visitors.