Using Python to automate LVM-Partitioning

What is LVM?

What is a Logical Volume?

Why use LVM?

Ways of Managing LVM:

Task Objective:

Procedure:

Commands used:

pvcreate <disk_name1> <disk_name2> <disk_nameN>
vgcreate new_vol_group <disk_name1> <disk_name2> <disk_nameN>
lvcreate --size <size> --name <new_logical_volume> <new_vol_group>
mkfs.ext4 /dev/new_vol_group/new_logical_volume
mount /dev/new_vol_group/new_logical_volume /test
lvextend --size <size> /dev/new_vol_group/new_logical_volume
resize2fs /dev/new_vol_group/new_logical_volume

These have been used to create a CLI-Menu for LVM :

Opt.1]

This will display disk info

Opt.2]

Using this, we can create new PV

Opt.3]

Creates a VG

Opt.4]

Creating a new LVM

Opt.5]

Expanding it

Testing whether the LV was created , mounted and partitioned:

Checking its existence

GitHub Repo:

Thank you for the time~!