active devel
This commit is contained in:
parent
f4449481a7
commit
51f5b703cc
47
df_check.py
47
df_check.py
|
@ -2,26 +2,65 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
#fileoperations
|
||||||
file = open("/proc/partitions", "r")
|
file = open("/proc/partitions", "r")
|
||||||
parts = file.read()
|
parts = file.read()
|
||||||
file.close()
|
file.close()
|
||||||
|
file = open("/proc/mounts", "r")
|
||||||
|
mounts = file.read()
|
||||||
|
file.close()
|
||||||
|
|
||||||
# getting all local partitions (regardless if mounted or not)
|
#definitions
|
||||||
partitions = []
|
partitions = []
|
||||||
blocks = []
|
blocks = []
|
||||||
|
mountpoints = []
|
||||||
|
|
||||||
|
# getting all local partitions (regardless if mounted or not)
|
||||||
for line in parts.split("\n"):
|
for line in parts.split("\n"):
|
||||||
if line and "name" not in line and "sr0" not in line:
|
if line and "name" not in line and "sr0" not in line:
|
||||||
if line.split()[2] != "1":
|
if line.split()[2] != "1":
|
||||||
partitions.append(line.split()[3])
|
partitions.append("/dev/" + line.split()[3])
|
||||||
blocks.append(line.split()[2])
|
blocks.append(line.split()[2])
|
||||||
|
|
||||||
print "partitions: %s \nblocks: %s" %(partitions, blocks)
|
|
||||||
|
hold="nothing"
|
||||||
|
holdblocks = 0
|
||||||
|
blockcount = 0
|
||||||
|
counter = 0
|
||||||
|
for part in partitions:
|
||||||
|
if hold in part:
|
||||||
|
print "part %s contains hold %s" %(part, hold)
|
||||||
|
blockcount = blockcount + int(blocks[counter])
|
||||||
|
print blockcount
|
||||||
|
else:
|
||||||
|
print "part %s does not contain hold %s" %(part, hold)
|
||||||
|
hold = part
|
||||||
|
holdblocks = blocks[counter]
|
||||||
|
blockcount = 0
|
||||||
|
counter += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exit()
|
exit()
|
||||||
|
#getting mountpoints to devices
|
||||||
|
for item in partitions:
|
||||||
|
for line in mounts.split("\n"):
|
||||||
|
if line and item in line:
|
||||||
|
mountpoints.append(line.split()[1])
|
||||||
|
break
|
||||||
|
# mountpoints.append("%s not mounted" %(item))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print "partitions: %s\nblocks: %s\nmountpoints: %s" %(partitions, blocks, mountpoints)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exit()
|
||||||
|
|
||||||
# given paths(mountpoints)
|
# given paths(mountpoints)
|
||||||
path=("/boot", "/", "/dev/sda6")
|
path=("/boot", "/", "/dev/sda6")
|
||||||
|
|
||||||
|
|
Reference in New Issue