growpart uses wrong device for partition for dm block devices

Bug #2069023 reported by Mariani Alberto
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-initramfs-tools
New
Undecided
Unassigned

Bug Description

When trying to grow a partition on a DM block device (for example a multipath device), growpart creates the wrong name for the partition to grow:

real case output:

growpart -N -v /dev/mapper/root01 2
/dev/mapper/root01 resolved to /dev/dm-2
update-partition set to true
resizing 2 on /dev/dm-2 using resize_sfdisk_dos
209717760 sectors of 512. total size=107375493120 bytes
## sfdisk --unit=S --dump /dev/dm-2
label: dos
label-id: 0x316e4f76
device: /dev/dm-2
unit: sectors

/dev/mapper/root01p1 : start= 2048, size= 2097152, type=83, bootable
/dev/mapper/root01p2 : start= 2099200, size= 199784448, type=8e
FAILED: failed to get start and end for /dev/dm-22 in /dev/dm-2

growpart wants to use partition /dev/dm-22, which does not exist in this case. It could very well also be a different multipath device, possibly leading to data loss.

The correct partition name is /dev/mapper/root01p2 which is a symlink to /dev/dm-5 (and has nothing to do with /dev/dm-2): the actual partition name should be composed by appending the "p2" part to the original disk name provided on the commandline instead of the resolved name, then it can be followed to the actual device in case of a symlink.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.