-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatic_Partition.py
More file actions
86 lines (74 loc) · 3.01 KB
/
Static_Partition.py
File metadata and controls
86 lines (74 loc) · 3.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import os
import getpass
print("\n\t\t**....................##.........................**")
os.system("tput setaf 3")
print("\n\t*****************WELCOME In MY AUTOMATION TOOL*****************")
os.system("tput setaf 7")
print("\n\t\t**....................##.........................**")
passwd = getpass.getpass("\nEnter your password: ")
if passwd != "root":
print("\n password is incorrect.Please enter right password. ")
exit()
os.system("tput setaf 3")
print("\n\tThank You...")
print("\n\t############ You locally logged in successfully ###########")
os.system("tput setaf 7")
def option():
op = int(input('''
\n
..............#WELCOME IN MAIN MENU#................
\n
Press 1 : To Create a Static Partition..
press 2 : Format and mount partition..
Press 3 : To increase size of Partition..
Press 4 : To decrease size of partition..
Press 5 : To delete the static partiton..
press 6 : exit..
\n
what can I help you..: '''))
if op == 1:
os.system("\n yum install parted")
name1= input("\n\tEnter your harddisk that you want..>> ")
part1= input("\n\tEnter start point of partition..>> ")
part2= input("\n\tEnter end point of partition..>> ")
os.system("parted {} mkpart primary ext4 {}G {}G;".format(name1,part1,part2))
os.system("lsblk")
option()
elif op == 2:
name3= input("\n\t Enter the name of partition..>> ")
os.system("mkfs.ext4 {}".format(name3))
name4= input("\n\t Enter the folder name that you want..>>" )
os.system("mkdir \{}".format(name4))
os.system("mount {} {}".format(name3name4))
os.system("lsblk")
elif op == 3:
name1= input("\n\t Enter the name of harddisk..>> ")
num1= input("\n\t Enter the number of partition..>> ")
size1= input("\n\t Enter the incresing end point size..>> ")
os.system("parted {} resizepart {} {}G".format(name1,num1,size1))
os.system("lsblk")
option()
elif op == 4:
name1= input("\n\t Enter the name of harddisk..>> ")
num1= input("\n\t Enter the number of partition..>> ")
size2= input("\n\t Enter the decreasing end point size..>> ")
os.system("parted {} resizepart {} {}G".format(name1,num1,size2))
os.system("lsblk")
option()
elif op == 5:
name1= input("\n\t Enter the name of harddisk..>> ")
num1= input("\n\t Enter the number of partition..>> ")
os.system("parted {} rm {}".format(name1,num1))
os.system("lsblk")
option()
elif op == 6:
os.system("exit")
os.system("tput setaf 3")
print("\n\n\t#########..THANK YOU..See you soon..#########")
os.system("tput setaf 7")
print("\n")
else:
print("Incorrect Choice,select correct option..")
anykey =input("\n\t Press Enter to go main menu")
option()
option()