Skip to main content

parse_partition_number_from_suffix

Function parse_partition_number_from_suffix 

Source
pub(crate) fn parse_partition_number_from_suffix(
    parent_path: &str,
    esp_path: &str,
) -> Option<String>
Expand description

Extract a partition number by stripping the parent device path from the ESP partition device path, then skipping any non-digit separator characters.

Multipath partition devices are named by appending a partition suffix to the parent device path. The suffix may include a separator like “p” before the digits:

  • /dev/mapper/mpatha + 2/dev/mapper/mpatha2
  • /dev/mapper/mpatha + p2/dev/mapper/mpathap2

This function returns None if the ESP path doesn’t start with the parent path or if no trailing digits are found in the suffix.