Partitioning¶
Partition management functions.
- lmi.scripts.storage.partition.create_partition(ns, device, size=None, partition_type=None)¶
Create new partition on given device.
Parameters: - device (LMIInstance/CIM_StorageExtent or string) – Device which should be partitioned.
- size (int) – Size of the device, in blocks. See device’s BlockSize to get it. If no size is provided, the largest possible partition is created.
- partition_type (int) – Requested partition type. See PARTITION_TYPE_xxx variables. If no type is given, extended partition will be automatically created as 4th partition on MS-DOS style partition table with a logical partition with requested size on it.
Return type: LMIInstance/CIM_GenericDiskPartition.
- lmi.scripts.storage.partition.create_partition_table(ns, device, table_type)¶
Create new partition table on a device. The device must be empty, i.e. must not have any partitions on it.
Parameters: - device (LMIInstance/CIM_StorageExtent) – Device where the partition table should be created.
- table_type (int) – Requested partition table type. See PARTITION_TABLE_TYPE_xxx variables.
- lmi.scripts.storage.partition.delete_partition(ns, partition)¶
Remove given partition
Parameters: partition (LMIInstance/CIM_GenericDiskPartition) – Partition to delete.
- lmi.scripts.storage.partition.get_disk_partition_table(ns, device)¶
Returns LMI_DiskPartitionTableCapabilities representing partition table on given disk.
Parameters: device (LMIInstance/CIM_StorageExtent or string) – Device which should be examined. Return type: LMIInstance/LMI_DiskPartitionConfigurationCapabilities.
- lmi.scripts.storage.partition.get_disk_partitions(ns, disk)¶
Return list of partitions on the device (not necessarily disk).
Parameters: device (LMIInstance/CIM_StorageExtent or string) – Device which should be partitioned. Return type: List of LMIInstance/CIM_GenericDiskPartition.
- lmi.scripts.storage.partition.get_largest_partition_size(ns, device)¶
Returns size of the largest free region (in blocks), which can accommodate a partition on given device. There must be partition table present on this device.
Parameters: device (LMIInstance/CIM_StorageExtent or string) – Device which should be examined. Return type: int
- lmi.scripts.storage.partition.get_partition_disk(ns, partition)¶
Return a device on which is located the given partition.
Parameters: partition (LMIInstance/CIM_GenericDiskPartition or string) – Partition to examine. Return type: LMIInstance/CIM_StorageExtent.
- lmi.scripts.storage.partition.get_partition_tables(ns, devices=None)¶
Returns list of partition tables on given devices. If no devices are given, all partitions on all devices are returned.
Parameters: devices (list of LMIInstance/CIM_StorageExtent or list of strings) – Devices to list partition tables on. Return type: List of tuples (LMIInstance/CIM_StorageExtent, LMIInstance/LMI_DiskPartitionConfigurationCapabilities).
- lmi.scripts.storage.partition.get_partitions(ns, devices=None)¶
Retrieve list of partitions on given devices. If no devices are given, all partitions on all devices are returned.
Parameters: devices (List of LMIInstance/CIM_StorageExtent or list of string) – Devices to list partitions on. Return type: List of LMIInstance/CIM_GenericPartition.