Skip to main content

No project description provided

Project description


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


git clone
sudo pip install ./


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


Read partitions table.


Create compressed archive from all partitions."mbr_file", target_dir="/home/user/Desktop")

For more examples please use files in the example directory


pysfdisk is licensed under GPL v2.


  • pre-alpha 0.0.1 2016 - Matt Comben
  • GA 1.0.0 2020 - Tomasz Szuster

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py-disk-imager, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size py-disk-imager-1.0.1.tar.gz (7.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page