The kpartx command fails to add parition mapping to multipath devices when using partition delimiter 'p'
Issue
- Two multipath devices. The below example uses
mpathdandmpathdp. These are aliases in this case but the same issue is reproducable with user friendly names.
mpathd (13ET 00013001) dm-8 IET,VIRTUAL-DISK
size=4.0G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 4:0:0:1 sde 8:64 active ready running
|- 6:0:0:1 sdg 8:96 active ready running
`- 5:0:0:1 sdi 8:128 active ready running
mpathdp (15ET 40010002) dm-9 IET,VIRTUAL-DISK
size=4.0G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 4:0:0:2 sdf 8:80 active ready running
|- 5:0:0:2 sdj 8:144 active ready running
`- 6:0:0:2 sdh 8:112 active ready running
- A look at the current mappings. Please note that
mpathdp1partitition is formpathd, notmpathdp.
[root@rhel6a ~]# ls -l /dev/mapper/mpath*
lrwxrwxrwx 1 root root 7 Jul 1 12:08 /dev/mapper/mpathd -> ../dm-9
lrwxrwxrwx 1 root root 7 Jul 1 12:08 /dev/mapper/mpathdp -> ../dm-8
lrwxrwxrwx 1 root root 8 Jul 1 12:08 /dev/mapper/mpathdp1 -> ../dm-10
[root@rhel6a ~]# parted /dev/mapper/mpathd print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathd: 4291MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 4285MB 4285MB primary
[root@rhel6a ~]# parted /dev/mapper/mpathdp print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathdp: 4291MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
[root@rhel6a ~]# parted /dev/mapper/mpathdp print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathdp: 4291MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
- Add a new partition to
mpathdp.
[root@rhel6a ~]# fdisk /dev/mapper/mpathdp
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-521, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-521, default 521):
Using default value 521
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: 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)
Syncing disks.
- Use
kpartxto add partition.
[root@rhel6a ~]# kpartx -av /dev/mapper/mpathdp
add map mpathdp1 (253:10): 0 8369802 linear /dev/mapper/mpathdp 63
[root@rhel6a ~]# ls -l /dev/mapper/mpath*
lrwxrwxrwx 1 root root 7 Jul 1 12:12 /dev/mapper/mpathd -> ../dm-9
lrwxrwxrwx 1 root root 7 Jul 1 12:14 /dev/mapper/mpathdp -> ../dm-8
lrwxrwxrwx 1 root root 8 Jul 1 12:14 /dev/mapper/mpathdp1 -> ../dm-10
- As you can see, we get an entry for
mpathdp1, which is the partition formpathd, notmpathdp. It seems we should get the devicempathdpp1. However this is not the case, when we use thekpartxcommand, it will not add the partition delimeter by default. For example, when we runkpartx -avonmpathx, we are telling it to make mpathx1, not mpathxp1. Note the lack of the partition delimiter. So, in our example we're trying to make a partitition mapping name that is already present.
Environment
- Red Hat Enterprise Linux 6
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
