LVM Automation Using Python

Rohit Raut
3 min readDec 14, 2020

--

What if your root drive runs out of space and You want to take space from the other disk and provide it to the root disk. is it possible?

A solution to this problem is LVM and stands for Logical Volume Management. To create a logical volume, First, we need to create physical volume. combine multiple physical volumes into a single pool of storage called Volume Group. From Volume Group, we can create a partition known as Logical Volume. We can extend or reduce these logical volumes as per our needs.

LVM Architecture.

LVM Architecture

I have automated this part using python3. In this article, I am going to show you how it works.

Automated Script for operating System that has password-based authentication.

This is how it works it will ask you for a target machine authentication type i.e password or key.

option 1: show all HD

Option 2: Display Mount Points

Option 3: Create PV/VG/ LV

Option 4: Display PV/VG/LV

Option 6: Mount LV

Option 8: Extend LV

Option 9: Reduce VG/LV

option 5: Delete PV/VG/LV

Automated Script for operating System that has Key-based authentication.

EC2 Instance

🤩working great. GitHub link is provided below, download the code and test it. If you are getting any error please contact me on LinkedIn.

GitHub Link: https://github.com/rohitraut3366/Logical-Volume-Manager-Automation-Using-Python.git

Thank you for reading!!😇😇

Connect with me On LinkedIn for further queries.

--

--

No responses yet