Skip to content

vojtechtrefny/pyblkid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

119 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pylibblkid

PyPI version

Python bindings for libblkid library.

Usage examples

Probing a device

import blkid

pr = blkid.Probe()
pr.set_device("/dev/sda1")

pr.enable_superblocks(True)
pr.set_superblocks_flags(blkid.SUBLKS_TYPE | blkid.SUBLKS_USAGE | blkid.SUBLKS_UUID)

pr.do_safeprobe()

# print device properties as a dictionary
print(dict(pr))

Searching for device with specified label

import blkid

cache = blkid.Cache()
cache.probe_all()

dev = cache.find_device("LABEL", "mylabel")

# if found print found device and its properties
if dev:
    print(dev.devname)
    print(dev.tags)

About

Python bindings for libblkid library.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •