@@ -19,31 +19,30 @@ def createPhysicalVolume(VolumeList):
19
19
print (f"{ i } Drive is converted to Physical Volume" )
20
20
print ("All the drives are converted to Physical Volume" )
21
21
22
- def extendVolumeGroup (Volume ):
23
- os .system (f"vgextend { Volume } " )
22
+ def extendVolumeGroup (Volume , vgname ):
23
+ os .system (f"vgextend { vgname } { Volume } " )
24
24
print (f"{ Volume } is added to Volume Group" )
25
25
26
26
def createVolumeGroup (VolumeList ):
27
27
volGrpName = input ("Enter the name you want to give to your Volume Group: " )
28
28
os .system (f"vgcreate { volGrpName } { VolumeList [0 ]} " )
29
29
for i in range (1 ,len (VolumeList )):
30
- extendVolumeGroup (VolumeList [i ])
30
+ extendVolumeGroup (VolumeList [i ], volGrpName )
31
31
print ("Volume Group created with the name {}!" .format (volGrpName ))
32
32
return volGrpName
33
33
34
34
def createLogicalVolume (volGrpName ):
35
35
logVolName = input ("Enter the name you want to give to your Logical Volume: " )
36
36
logVolsize = input ("Enter the size of Logical Volume you want to create(in G): " )
37
- os .system (f"lvcreate --size { logVolsize } G --name { logVolName } " )
37
+ os .system (f"lvcreate --size { logVolsize } G --name { logVolName } { volGrpName } " )
38
38
print (f"Logical Volume of size { logVolsize } GB is created with the name { logVolName } " )
39
39
return logVolName
40
40
41
41
def extendLogicalVolume (volGrpName ,logVolName ):
42
- volGrpName = input ("Enter the name of your Volume Group: " )
43
- logVolName = input ("Enter the name of your Logical volume: " )
44
42
addvol = input (f"How much you want to add extra in { logVolName } (in GB): " )
45
43
os .system (f"lvextend --size +{ addvol } G /dev/{ volGrpName } /{ logVolName } " )
46
44
print (f"Logical Volume size increased by { addvol } " )
45
+ os .system ("df -h" )
47
46
48
47
def decreaseLogicalVolume (volGrpName ,logVolName ):
49
48
print ("WARNING THIS CAN DESTROY YOUR DATA AND NOT SUPPORTED IN GFS2 AND XFS FORMATS\n " * 3 )
@@ -58,17 +57,19 @@ def firstFormat(logVolName,volGrpName):
58
57
59
58
def extendedFormat (logVolName ,volGrpName ):
60
59
os .system (f"resize2fs /dev/{ volGrpName } /{ logVolName } " )
61
- print ("Formated extended Volume!" )
60
+ print ("Formated the extended Volume!" )
62
61
63
62
def mount (logVolName ,volGrpName ):
64
63
des = input ("Do you have existing dir on which you have to mount?:(Y/N) " )
65
64
dirname = ''
66
65
if (des == 'Y' ):
67
66
dirName = input ("Add dir path you want to mount: " )
68
67
else :
69
- dirname = input ("Give name to dir where you want to mount: " )
68
+ dirName = input ("Give name to dir where you want to mount: " )
70
69
os .system (f"mkdir /{ dirName } " )
71
- os .system (f"mount /dev/{ volGrpName } /{ logVolName } " )
70
+ os .system (f"mount /dev/{ volGrpName } /{ logVolName } /{ dirName } " )
71
+ os .system ("df -h" )
72
+ print (f"Disk has mounted over the /{ dirName } " )
72
73
73
74
def detailsPhysicalVolume ():
74
75
pv = input ("Enter the Physical Volume which you want to see details: " )
0 commit comments