-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlvm.py
More file actions
55 lines (55 loc) · 2.01 KB
/
lvm.py
File metadata and controls
55 lines (55 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
def lvm():
while True:
os.system("clear")
os.system("tput setaf 4")
os.system("figlet -f slant -c LVM World")
os.system("tput setaf 7")
print("""
[1]To check number of storage attached to the OS
[2] To create Physical Volume
[3] To view Physical Volume
[4] To create Volume Group
[5] To view Volume Group
[6] To create Logical Volume
[7] To view Logical Volume
[8] To format the LV
[9] go back to main menu
[10] Exit the program""")
i = int(input("Enter your Choice:"))
if i==1:
os.system("fdisk -l")
elif i==2:
pv1=input("Enter the name of storage 1:")
pv2=input("Enter the name of storage 2:")
os.system("pvcreate {}".format(pv1))
os.system("pvcreate {}".format(pv2))
elif i==3:
pv=input("Enter the name of storage:")
os.system("pvdisplay {}".format(pv))
elif i==4:
vg=input("Give name to the Volume Group:")
pvn1=input("Enter the name of storage 1:")
pvn2=input("Enter the name of Storage 2:")
os.system("vgcreate {} {} {}".format(vg,pvn1,pvn2))
elif i==5:
vg1=input("Enter the name of Volume Group:")
os.sytem("vgdisplay {}".format(vg1))
elif i==6:
size=input("Enter size for your Logical Volume:")
lv=input("Give name to your Logical Volume:")
vg2=input("Enter name of the Volume Group:")
os.system("lvcreate --size{} --name{} {}".format(size,lv,vg2))
elif i==7:
os.system("lvdisplay")
elif i==8:
vg4=input("Enter the name of Volume Group:")
lv2=input("Enter the name of Logical Volume:")
os.system("mkfs.ext4 /dev{}{}".format(vg4,lv2))
elif i==9:
break
elif i==10:
exit()
else:
print("This option doesn't support")
input("\nPress Enter to try again...")