This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
2012-05-16 17:26:09 +02:00
|
|
|
#!/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
|
2012-05-16 17:32:04 +02:00
|
|
|
parts = {} #initializing empty dictionary for partitions and uuids
|
|
|
|
for uuid in uuids: #write /dev/names as keys and uuids as values in the dictionary
|
|
|
|
parts["/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:]] = uuid
|
2012-05-16 17:26:09 +02:00
|
|
|
return parts #return the dictionary for further useage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
partitions = getpartitions()
|
|
|
|
print partitions
|
|
|
|
|