LVM(Logical Volume Manager)

Hi guys I’m back with another blog here we are going to create an LVM not only creating even going to merge two devices, gone an increase, decrease the size of storage. Lets dev friends

How to Resize LVM Partition Inside an Extended Partition

  1. Create a new partition on the hard disk.
  2. Add the partition you just created as a physical volume.
  3. Add the new physical volume to the volume group.
  4. Assign space from the volume group to the logical volume.
  5. Resize the filesystem.

What is Partition?

What is Logical Volume?

What is Volume Group?

What is Physical Volume?

Internal working

Let’s dev into practical

Shut down your VM and increase the disk size

>> fdisk -l
Shows fdisks

Creating an LVM

>> df -Th
shows mounted devices

Creating a PV

>> pvcreate <disk_name>
>> pvdisplay
Create PV (Physical Volume)

Creating Volume Group with name LVMgroup

>> vgcreate <Group_name> <Disk_1> <Disk_2>
>> vgdiplay <Group_name>
Create LV

Creating Logical Volume

>> lvcreate --size <give_size>G --name <name_of_LV> <NameOf_VG>
>> lvdisplay <LV_name>
Create LV

Do format a storage

>> resize2fs /dev/<group_name>/<LV_name>>> mount /dev/<group_name>/<LV_name> <folder_path_path_toMount>>> df -Th
Format storage

Increase Size of Logical Volume

>> lvextend --size +<Size_to_increase>G /dev/<group_name>/<LV_name>
>> resize2fs /dev/<group_name>/<LV_name>
Increase LVM

Decrease A Logical Volume Size

>> umount <mounted_path>
>> e2fsck  -f /dev/<group_name>/<LV_name>
>> resize2fs /dev/<group_name>/<LV_name> <sizeToFormat>G
>> lvreduce -L <sizeToReduce>G /dev/<group_name>/<LV_name>
Decreasing Logical Volume

Thanks for Reading !!

Keep Learning !! Keep Sharing !!

You can contact me on😅:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vinodha kumara

Vinodha kumara

ARTH-School of technology, BCA graduate