parted package

Parted module.

This module presents a pythonic interface to the parted library. cffi is used to bind to the parted library.

Example

>>> from parted import device, disk, constraint
>>> dev = device.Device('/dev/sda')
>>> dsk = dev.disk
>>> # print information about the partition table
>>> print(disk.debug())
>>> with dev.open() as d:
...     first = dev.read(0)
...     last = dev.read(-1)
...     print(first, last)
>>> # clobber partition table
>>> dev.clobber()
>>> # create a new partition table (disk)
>>> dsk = dev.new_table(disk.DiskType.WNT.GPT)
>>> # create a new partition on table
>>> part = disk.Partition.new(dsk, disk.PartitionType.NORMAL, filesys.FileSystemType.WNT.ext4, 2048, 4095)
>>> # add the partition to the table
>>> dsk.add_partition(part, constraint.Constraint.any())
author:

Adolfo Gómez, dkmaster at dkmon dot com

Submodules