pub fn format_disk_and_get_first_partition(
device: &Device,
partition_type: PartitionKind,
disk_signature: Option<u32>,
) -> Result<PartitionDevice>
Expand description
Format disk to MBR if it doesn’t contain valid MBR and return first partition device
This function checks if the device contains a valid MBR. If not, it creates a new MBR with a single partition using the full disk size. It then returns a partition device for the first partition.
§Arguments
Device
- The device to format and get partition fromPartition_type
- The type of partition to create if formatting is neededDisk_signature
- The disk signature to use when creating new MBR (optional, uses random if None)
§Returns
Result<Partition_device_type>
- The first partition device