LOGICAL VOLUME MANAGER
- what is LVM and it’s example
- Advantage of LVM
- Possibilities of LVM
- Real -time LVM example
- Adding new space/disk using LVM
- Extending the space using LVM
LVM Is used to manage volume and disk on the Linux server,Logical volume Manager allows disk to be combined together.
Example of LVM
- LIKE Partition of disk in windows C, D Drive similarly we can do the same in the Linux.
- Single disk can be divided into different partitions.
- Multiple disk combined and group them into one -> then change it into different partitions.
Advantage OF LVM
IN Case of disk is running out of space, you can add disk without breaking of your file system.
Possibilities of LVM
- New space can be created on a server for new project.
- in case of low disk space, increase the space.
- in case of extra space allocated to a partition ,capacity can be reallocated (reduce capacity in one volume group and add it to another).
We need to deploy two new applicationsapp1 and app2 on our server and need a separate partitions and space for each application.
Steps of lVM for adding new space
- install new hard disk drive.
- Make a partition to use it.
- Desiganate physical volume (pv).
- Manage volume group (VG).
- Manage logical volume (LV).
- Apply a filesystem.
- Set a mount point.
Partition using ‘fdisk’
Follow the below steps to create new partition.
Designate physical volumes (pv) so that it will be available to lLVM as storage capacity.
- Command to create a PV
- #pvcreate /dev/sdb1
Display pv capacity and additional information :(#pvdisplay)
Manage Volume groups (vGS)
VG must have at least one member (vg 00 is our group name and others are our PVS)
TO display information for a VG NAMED VG00
Apply a filesystem and set a mount point.
Run the mkfs.ex4 command on the LV.Create a mount point by using mkdir.
Manuallymount the volume using the mount command, or edit the /etc/fstab file to mount the volume automatically when the system boots.
use the df -h command to verify the storage capacity available.
Extending a Disk using LVMFor the frist time we have created a VG , now we will extend it#vgextend vgapps /dev/sdb2Add spaces to LV #lvextend -L+1G /dev/vgapps/app1-lv
- Make this new space available to Filesystem
- Here is the basic command for ext4.
- #resize2fs /dev/vgapps/app1-lv 3T.
- you can use the below command for xFS.
- #Xfs_growfs /dev/vgapps/app1-iv (now check using df -h ).