Automating LVM Using Python Script
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoWlHA9Sx3GtRp0eQAbgxxO_bKqSisKNFxk4Mf1bdSIqbQeAzsBvGWZTi1PEh81u_gLCdnBWcFHIiTKocmj9qIw2jPvGq57Jo7h9Gxi3Qt1wgc0k6R6cCOoAhnLjA3mxk6Bwxo-D9scSI/s16000/1-m0H6-tUbW6grMlezlb52yw.png)
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
/dev/sdb
/dev/sdc
we will use /dev/sdb for this demo
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5haaB88j4NqO2_Ircu-Sc_xI3GT_mIHAi2Bv9Wvgcimco9JInYB4D9b0DQc5kyoTSQxQ7o3JkMyq2ZTaD1WM0Jnjdj1T_QnO7voQVBjJdOxuF7vIxfeT5c4BveEZBjkxiMam7WX-b1_Q/s16000/1-FCD1kxk13laKQYgdiuy0gw+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJTKUJbCH4kLhzUwTB1YHvrlqmftE_6kn4FwqaV0s6BaUje2M71NIceFBVpSpyB1Y_lYPyrWFCfJBm0Tni5NkPQd1ZQIz1OT_HNatfr4hx0_sQFJeKbMyIgGBeOo43jcRVQVp9LeEfmIo/s16000/1-NFPE7VnBrfEhJDx70JtcSA+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0S1cyGvB6ccrkxsu0dT37soQFb8AaYQe7D-XlI8Kv0vro6TaDtIojv4WoANNieEDaHQYA7OIaEkcha2VmSy2zFvAqWhWTsePUSlAG-bRyY2yfR5794QnsLmPal8eONukZ4ZPgC5Q4jh8/s16000/1-AFbfg5GaDtfg7T82EfYmAw+%25281%2529.png)
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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmoqW0sHQ-sjIyMRYC3kLrAsiZHI2erhpbfvr2OBZMRB5um-fxEBhVR3y_a3YvQ-avXWUaT5JH_Jq_tE_kzqaMEU8tVmOjkhAP88-f3ZvE8fg9GO6xdR59F8Xy37og6MTAn26SwLCYi4A/s16000/1-JOK7uo5zqqgukvniQeNQ_w+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN5KhiE-Piw20DLfU4iZyoE7b9sWvxcvB4QGKRSMwPRFjF9X9Lqn9pT-rUHCnLU2JCu1PR5026JcR-4bFCEXxn8rfE1hEh5QF_k7-OpMRDWYOZtPnkNSzhyphenhyphenckZ0WGFDIJH8mirFeal09M/s16000/1-kbLpH2EncM_GMACxtnVimQ+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9bPvZxjQCVyyfcGiaYps2fVo7vLTOFq98vGnmpSgBQDLhgn4aE6CkZhyphenhyphen77ClcWt8p2BSYs9G6NI8gIkgv0L0AemuFMzeTNC9pwbwRi452WkmNgrGz-poQXHvIfWPNGa6kWXvZ-cI2m6c/s16000/1-T87RjeFSagHiyANAqrQGYw+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgksSucAHNFArPNeqxhdgV1eG9-d8vSpdebcrtyZiaoldUW48T-FrCsS6Pv3VL0QywO0NasbZURaQ0UfVsGGfa5s9amYu2UGLdj3SSc5iiRB1j3CC6mA49VZX5VpWiBZJ6i4QbrUzgZGyw/s16000/1-TF4diomOLWwQZlD_s1Okdg+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihYg78676G3dSu9EzD3jlEWLVJ1gQMqoKcwEdeSfuB8vVL3W_dNLTBcNFyyRlySvpytpp7Iy5iXtci_WYQFLdCV5Ae6FEhAPMCr-aJFMYMnQHkpZ5iO7hLRefNaLqnKx9Q_HqQMRoKc3U/s16000/1-dbkIpbxF1vUSMbnB0vhO4w+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtV1r1avV5vO7hG8qjpk4vVhFihyphenhyphen_8Mk97Jp2D7FIZOzXKpD8SmuE4hWgJK8RAh0mfGEPgZUfdZSaBCdDOiXVXQ4VQGY5EpN_Kq3RrtqtqQCCqeoy36SzqeJj06PJTDudkKzlLhE0_O-I/s16000/1-SX6t6qFgugHas61Hqf3Orw+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6RkOcEYiT1yJLvzzsU3MUgzcJUL7V_c1npjqC8b4BMZ0ahaZ7YiU2QsSAdphITCD3biSHQjQXbFceMas3X3EZv3_KNtT5TdRXcHkURLq7ig6UkW95dbMdZUotkBJn0nFCNG76eglbExw/s16000/1-WXsT-sCYRsmZPjQW7AaJ8A+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMx2FPMAshPyU6K58mJm3qvQp6EBExJ3pd_h4qPg-cW5N9_ziTFPPS8O2b1Iua1imCUz6hgFXjKkvrZ9zTY_y5noletJ8xETzz2UyKO3DKvXQvf32IZetLh611WE3CaXoDjiextKkLtkQ/s16000/1-v_lru_oPhqYi3xYazl0Ggw+%25281%2529.png)
Note: Before mounting you need to format the device
From option 11 we can mount this device to where you want
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwsCM3cRcpUc13lUj_lgrTsJu-6BJIzdmA3x2Fn29PHXMn24HE1QrhnIcevNkfyI0pSqWjZMEtU2wCoTO2_OuHg41M0JY7xzYAY6Plt3OSNL320aVffFpdBDgiUU5oJlHRQVOI9iM8f-4/s16000/1-n0OUR2AdXwZgnJ8r95TJew+%25281%2529.png)
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