#2235 PR merged: Improve handling of partition label type for multipath disks

Labels: enhancement, bug, cleanup, fixed / solved / done

petrpavlu opened issue at 2019-09-12 13:12:

Pull Request Details:
  • Type: Bug Fix / New Feature / Enhancement / Other?

    Bug Fix.

  • Impact: Low / Normal / High / Critical / Urgent


  • Reference to related issue (URL):


  • How was this pull request tested?

    Locally tested under KVM. Multipath configuration:

    # multipath -ll
    size=2.0G features='1 retain_attached_hw_handler' hwhandler='0' wp=rw
    |-+- policy='service-time 0' prio=1 status=active
    | `- 2:0:0:1 sdb 8:16 active ready running
    `-+- policy='service-time 0' prio=1 status=enabled
      `- 2:0:0:2 sda 8:0  active ready running
    # parted /dev/mapper/0QEMU_QEMU_HARDDISK_0001 print
    Model: Linux device-mapper (multipath) (dm)
    Disk /dev/mapper/0QEMU_QEMU_HARDDISK_0001: 2147MB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:
    Number  Start   End     Size    File system  Name     Flags
     1      1049kB  211MB   210MB   ext4         primary
     2      211MB   2147MB  1937MB  xfs          primary
  • Brief description of the changes in this pull request:

    When recording information about a multipath disk, ReaR did not store information about its partition label type (280_multipath_layout.sh). The recovery code create_multipath() (210_load_multipath.sh) -> create_partitions() (100_include_partition_code.sh) then tried to automatically detect the label type using a heuristic that depends on GPT partition names. The logic would incorrectly detect the device as having the MBR label type instead of GPT if one of the partition names was exactly "primary", "extended" or "logical".

    The patch fixes the problem by explicitly storing the partition label type for multipath devices as is already done for normal disks. The restore logic is accordingly updated to utilize this information.

    Fixes #2234.

jsmeix commented at 2019-09-13 12:06:

could you please review it because I know basically nothing about multipath.

In particular because this changes the syntax
of the multipath entries in disklayout.conf

jsmeix commented at 2019-10-16 08:02:

if you do not object, I would like to merge it tomorrow.

[Export of Github issue for rear/rear.]