PYsfdisk
A Python API for linux sfdisk utility
Note: Module will work only on Linux OS’es, required executables used in this module: * sudo * lsblk * sfdisk * pxz * tar * partclone
Please ensure that you have installed above
Install
git clone https://github.com/beskidinstruments/python-sfdisk sudo pip install ./
Example
import pysfdisk
Create block device object for the disk
disk = pysfdisk.BlockDevice(path='/dev/nvme0n1')
Optionally, if not using root and sudo is available, use this
disk = pysfdisk.BlockDevice(path='/dev/nvme0n1', use_sudo=True)
Partitions information is automatically loaded
disk.get_partitions()['0'].uuid
403ACCB2-0B00-465F-B190-B59C45CFD860
Read partitions table.
disk.read_partition_table()
Create compressed archive from all partitions.
disk.run(mbr_filename="mbr_file", target_dir="/home/user/Desktop")
For more examples please use files in the example directory
License
pysfdisk is licensed under GPL v2.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-disk-imager-1.0.1.tar.gz
(7.4 kB
view details)
File details
Details for the file py-disk-imager-1.0.1.tar.gz.
File metadata
- Download URL: py-disk-imager-1.0.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bba3259f6984229be0bcd3d40ed3b660a4f59d23deb0d7d3f6d73cbaff0de606
|
|
| MD5 |
f09b4775e246559c9dea4b18db1ebf67
|
|
| BLAKE2b-256 |
3c624cc3b5346ab65635f27f58572e0128e871465f3479c095a76e2da6fc05b9
|