Bug#827308: multipath-tools: wrong device file created when creating partitions with parted

Andrew Patterson andrew.patterson at hpe.com
Wed Jun 15 17:39:09 UTC 2016


On 06/15/2016 08:26 AM, Ritesh Raj Sarraf wrote:
> Thank you for testing the new version. FYI, I've pushed it to Unstable. So, in
> all probability, this is the version that'll be shipped with Stretch.
> 
> 
> On Tue, 2016-06-14 at 14:13 -0600, Andrew Patterson wrote:
>> Package: multipath-tools
>> Version: 0.6.1-3
>>
>> When using parted to create partitions, multipath partition device
>> files are created using kernel names rather than honoring the "-p
>> -part" option in the various udev rules. This issue exists in
>> multipath-tools/kpartx_0.6.1-3, but has been seen in earlier versions
>> of multipath-tools/kpartx as well.
>>
> 
> 
> Okay!! But what is the expected behavior ? To the best of my knowledge, the
> naming convention is specific to particular storage layer. In case of multipath,
> we delegate it to kpartx.

Yes, I would expect it to use the udev rules, e.g., mpatha-part1, not mpatha1.

> 
> 
>>  
>> # ls -l /dev/mapper
>> total 0
>> crw------- 1 root root 10, 236 Jun 14 13:28 control
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpatha -> ../dm-0
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathb -> ../dm-1
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathc -> ../dm-2
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathd -> ../dm-3
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathe -> ../dm-4
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathf -> ../dm-5
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathg -> ../dm-6
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathh -> ../dm-7
>>
>>
>> We then run parted on /dev/mapper/mpatha and create a label and a partition:
>>
>> # parted /dev/mapper/mpatha
>> GNU Parted 3.2
>> Using /dev/mapper/mpatha
>> Welcome to GNU Parted! Type 'help' to view a list of commands.
>> (parted) mklabel gptWarning: The existing disk label on /dev/mapper/mpatha
>> will be destroyed and all
>> data on this disk will be lost. Do you want to continue?
>> Yes/No? yes
>> (parted) mkpart primary ext2 0 100%
>> Warning: The resulting partition is not properly aligned for best performance.
>> Ignore/Cancel? i
>> (parted) quit
>> Information: You may need to update /etc/fstab.
>>
>> Under /dev/mapper, we see:
>>
>> # ls -l /dev/mapper
>> total 0
>> crw------- 1 root root 10, 236 Jun 14 13:28 control
>> lrwxrwxrwx 1 root root       7 Jun 14 13:57 mpatha -> ../dm-0
>> lrwxrwxrwx 1 root root       7 Jun 14 13:56 mpatha1 -> ../dm-8
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathb -> ../dm-1
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathc -> ../dm-2
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathd -> ../dm-3
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathe -> ../dm-4
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathf -> ../dm-5
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathg -> ../dm-6
>> lrwxrwxrwx 1 root root       7 Jun 14 13:53 mpathh -> ../dm-7
>>
>> Note that we see /dev/mapper/mpatha1 instead of /dev/mapper/mpatha-part1.
>>
>> Here is the udevadm monitor output during the partition creation:
>>
>> KERNEL[1654.655670] change   /devices/virtual/block/dm-0 (block)
>> UDEV  [1654.674470] change   /devices/virtual/block/dm-0 (block)
>> KERNEL[1686.963300] add      /devices/virtual/bdi/254:8 (bdi)
>> KERNEL[1686.963443] add      /devices/virtual/block/dm-8 (block)
>> UDEV  [1686.963889] add      /devices/virtual/bdi/254:8 (bdi)
>> KERNEL[1686.963916] change   /devices/virtual/block/dm-8 (block)
>> UDEV  [1686.972372] add      /devices/virtual/block/dm-8 (block)
>> UDEV  [1686.999211] change   /devices/virtual/block/dm-8 (block)
>> KERNEL[1699.598572] change   /devices/virtual/block/dm-0 (block)
>> KERNEL[1699.616084] add      /devices/virtual/bdi/254:9 (bdi)
>> KERNEL[1699.616215] add      /devices/virtual/block/dm-9 (block)
>> KERNEL[1699.616533] remove   /devices/virtual/block/dm-9 (block)
>> UDEV  [1699.616728] add      /devices/virtual/bdi/254:9 (bdi)
>> UDEV  [1699.620321] add      /devices/virtual/block/dm-9 (block)
>> UDEV  [1699.620427] remove   /devices/virtual/block/dm-9 (block)
>> KERNEL[1699.640199] remove   /devices/virtual/bdi/254:9 (bdi)
>> UDEV  [1699.640289] remove   /devices/virtual/bdi/254:9 (bdi)
>> UDEV  [1699.664986] change   /devices/virtual/block/dm-0 (block)
>>
> 
> 
> Do you know what these "remove" events are of ?

Not offhand. I can try udevadm test to perhaps figure it out.

> 
> 
>> This work properly when using fdisk:
>>
>> fdisk  /dev/mapper/mpathb
>>
>> Welcome to fdisk (util-linux 2.28).
>> Changes will remain in memory only, until you decide to write them.
>> Be careful before using the write command.
>>
>>
>> Command (m for help): n
>> Partition type
>>    p   primary (0 primary, 0 extended, 4 free)
>>    e   extended (container for logical partitions)
>> Select (default p): p
>> Partition number (1-4, default 1): 1
>> First sector (32768-2097151, default 32768):
>> Last sector, +sectors or +size{K,M,G,T,P} (32768-2097151, default 2097151):
>>
>> Created a new partition 1 of type 'Linux' and of size 1008 MiB.
>>
>> Command (m for help): w
>> The partition table has been altered.
>> Calling ioctl() to re-read partition table.
>> Re-reading the partition table failed.: Invalid argument
>>
>> The kernel still uses the old table. The new table will be used at the next
>> reboot or after you run partprobe(8) or kpartx(8).
>>
>> # ls -l /dev/mapper
>> total 0
>> crw------- 1 root root 10, 236 Jun 14 13:28 control
>> lrwxrwxrwx 1 root root       7 Jun 14 14:00 mpatha -> ../dm-0
>> lrwxrwxrwx 1 root root       7 Jun 14 14:00 mpatha1 -> ../dm-8
>> lrwxrwxrwx 1 root root       7 Jun 14 14:01 mpathb -> ../dm-1
>> lrwxrwxrwx 1 root root       7 Jun 14 14:01 mpathb-part1 -> ../dm-9
>> lrwxrwxrwx 1 root root       7 Jun 14 14:00 mpathc -> ../dm-2
>> lrwxrwxrwx 1 root root       7 Jun 14 14:00 mpathd -> ../dm-3
>> lrwxrwxrwx 1 root root       7 Jun 14 14:00 mpathe -> ../dm-4
>> lrwxrwxrwx 1 root root       7 Jun 14 14:00 mpathf -> ../dm-5
>> lrwxrwxrwx 1 root root       7 Jun 14 14:00 mpathg -> ../dm-6
>> lrwxrwxrwx 1 root root       7 Jun 14 14:00 mpathh -> ../dm-7
>>
>> KERNEL[1988.516908] change   /devices/virtual/block/dm-1 (block)
>> KERNEL[1988.547294] add      /devices/virtual/bdi/254:9 (bdi)
>> KERNEL[1988.547364] add      /devices/virtual/block/dm-9 (block)
>> KERNEL[1988.547807] change   /devices/virtual/block/dm-9 (block)
>> UDEV  [1988.547918] add      /devices/virtual/bdi/254:9 (bdi)
>> UDEV  [1988.548599] change   /devices/virtual/block/dm-1 (block)
>> UDEV  [1988.556555] add      /devices/virtual/block/dm-9 (block)
>> UDEV  [1988.572788] change   /devices/virtual/block/dm-9 (block)
>>
>> We have the same issue regardless of the friendly_user_names setting.
>>
> 
> 
> I have no clue why partitions created with parted do not reflect the desired
> changes (Or why the correct event is not generated).
> 
> Looking at the rules, kpartx is called as below, for partitions:
> 
> "/sbin/kpartx -u -p -part /dev/$name"
> 
> which is what is reflecting in your setup.

Yes, very strange. Perhaps strace might show us something.

> 
> 

-- 
Andrew Patterson
Hewlett-Packard Enterprise



More information about the pkg-lvm-maintainers mailing list