A library for reading and manipulating filesystem tables, such as /etc/fstab.
It uses ctypes to wrap libmount, part of util-linux.
Usage
Every reading and manipulation of the filesystem table should take place in a with block to take the lock:
from libmount import FilesystemTable
with FilesystemTable() as fstab:
print fstab[0].target
A FilesystemTable acts like a list, so you can slice and iterate:
with FilesystemTable() as fstab:
print [fs.source for fs in fstab]
print fs[2:5]
FilesystemTable objects contain Filesystem objects, that each have source, target, fstab and options attributes. The first three are strings, whereas the latter is set-like:
with FilesystemTable() as fstab:
fs = fstab[0]
# Will print e.g. "/dev/sda1 on / type ext4 (user_xattr)"
print fs
fs.source = '/dev/sda2'
print "Options: %s" % ", ".join(fs.options)
fs.options -= set(['user_xattr'])
To update the on-disk filesystem table, call save():
with FilesystemTable() as fstab:
for fs in fstab:
if fs.fstype in ('ext3', 'ext4'):
fs.options.add('user_xattr')
fstab.save()
Limitations
It is not yet possible to add or remove entries. This has not been thoroughly tested when run by non-privileged users.
Feedback
Feedback is gratefully received to infodev@oucs.ox.ac.uk, or as an issue in the issue tracker.
Metadata
Release files for libmount 0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| libmount-0.9.tar.gz | 2.8 kB | Without provenance | Details for libmount-0.9.tar.gz |
Release files / libmount-0.9.tar.gz
| Download URL | libmount-0.9.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
016b61dfce3e8b0a5ea9367dc44cb54a6fc80cb04d0e5493fca2be41b4ba504a
|
|
BLAKE2b-256 checksum How to use checksums |
fe4d3bd201d78d9ff51c2eeb278603dae915ef695999fb4cc132a28cc6f1cd0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for libmount 0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.