added a second diskusage file, it follows a different way
This commit is contained in:
parent
e893cd76e2
commit
4f9379c4e2
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/python2
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
# getting all local partitions plus their uuids
|
||||||
|
def getpartitions():
|
||||||
|
uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices
|
||||||
|
parts = {} #initializing empty dictionary for partition labels/names and uuids
|
||||||
|
for uuid in uuids: #write labels/names as keys and uuids as values in the dictionary
|
||||||
|
parts[os.readlink("/dev/disk/by-uuid/" + uuid)[6:]] = uuid
|
||||||
|
return parts #return the dictionary for further useage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
partitions = getpartitions()
|
||||||
|
print partitions
|
||||||
|
|
Reference in New Issue