Latest Updates

Automating LVM Using Python Script


Task Objective:- Automating LVM Partition using Python-Script.

In the last Blog, we have seen how we can perform LVM Partionaing in Linux in detail especially for the Hadoop data node But you can follow the partition part

You will get my Python script for LVM here, and In this blog, we will see how we can use this script to automate the manual work of LVM

https://github.com/venkateshpensalwar/ARTH

Following are the ScreenShots of the Live Demo:

This is the LVM Manager Menu you can choose an option according to your need




We have two devices empty That is,

/dev/sdb

/dev/sdc

we will use /dev/sdb for this demo



again you can see sdb and sdc using an option called “List of HDD Blocks”


you can create Physical volumes for LVM from 2 option as shown in the following image


Now we have created PV

we will create a Volume group from that Physical volume using option 3

Note: for the keeping short blog, I used only one Physical Volume you can use unlimited just follow the script instructions.



now our VG has been created so we will move towards creating logical volume using option 5 as you can see in the following image


we have successfully created our LVM and you can see LVM using option 9


Also, you can see it from option 10 that is list storage blocks


using option 7 you can see physical volumes that we have created in the first step


using option 8 you can see the Volume Group that we have created


using option 6 you can also increase your LVM on the fly you don't need to umount device


by using option 2 and 4 you can attach a new HDD and extend your storge of Volume Group you can see it on the following page


from option 10 you can see we have successfully created LVM

Note: Before mounting you need to format the device

From option 11 we can mount this device to where you want


we have successfully mounted this device and the device is ready to use


Conclusion:

So in this way, I have created a python script to automate our manual task and we also successfully created LVM using this Python script


No comments