Bug 466970 - pvcreate on /dev/mapper/mpathX does not work. Works on on mpathXpY however
Summary: pvcreate on /dev/mapper/mpathX does not work. Works on on mpathXpY however
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: device-mapper
Version: 5.2
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Steven J. Levine
QA Contact: Cluster QE
Depends On:
Blocks: 517897
TreeView+ depends on / blocked
Reported: 2008-10-14 20:00 UTC by John DeFranco
Modified: 2013-05-22 19:15 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 517897 (view as bug list)
Last Closed: 2009-09-03 16:08:34 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description John DeFranco 2008-10-14 20:00:49 UTC
Description of problem:

In section 4 of chapter 2 of the 5.2 Configuration and Administration guide for using device-mapper multipath, it says that I can use pvcreate on a non-partitioned disk:

pvcreate /dev/mapper/mpath0

However when I try that I get an error:

[root@westwing ~]# pvcreate -f /dev/mapper/mpath8
  Can't open /dev/mapper/mpath8 exclusively.  Mounted filesystem?

However a pvcreate on a partition works ok:

[root@westwing ~]# pvcreate -f /dev/mapper/mpath8p1
  Physical volume "/dev/mapper/mpath8p1" successfully created
[root@westwing ~]# 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Configure device mapper
2.Run pvcreate /dev/mapper/mpath0
Actual results:

Expected results:

Additional info:

Comment 1 Christophe Varoqui 2008-10-14 21:13:36 UTC
What happens is that the "partition" mpath0p1 is a linear device-map holding mpath0. This holder is the reason which the open-exclusive test tried by pvcreate fails.

This behaviour seems sane to me : if you set up a partition, use it. If the partition is not necessary remove it (which is clearly the preferred choice there)

Partition is removal should be handled using "kpartx -d ..." *and* "fdisk" on mpath0.

Comment 2 Milan Broz 2008-10-14 21:25:23 UTC
I do not quite well understand what which mapping you want to use:
- if you want use partitions on mpath8, use mpath8pX - it works
- if you want to use the whole device, do not create partition table on it,
do not activate partitions and use it directly

I expect kpartx maps partitions here, so device cannot be used while partitions
are active on it (partitions here are just device-mapper mappingns, so it locks

Try to run "kpartx -d /dev/mapper/mpath8" (remove partition mappings adn - as Christophe said - remove it with fdisk too) and run pvcreate again.

Does it solve the problem for you? Or the bug report is about some documentation issue only?

Comment 3 John DeFranco 2008-10-14 21:51:01 UTC
Your explaination is find but this seems like a documentation issue. You've explained why its locked in the first case but the error message is not very descriptive and until you've said their may be a lingering partition around and locked I would not have known how to resolve that.

Comment 4 Jonathan Earl Brassow 2009-05-21 14:18:46 UTC
Assigning to the documentation team.  I couldn't hurt to mention this...

Comment 5 Steven J. Levine 2009-06-26 16:30:51 UTC
On June 16 I sent this note to Jonathan Brassow:


I'm looking at Bug 466970, which you assigned to me so that I would document that if you have partitions on a multipathed device you can't create a physical volume on the device directly.

So I'm thinking of adding a note to the DM-Multipath book. Right on this page:


The Note would say something like:

If you attempt to create an LVM physical volume on a whole device on which you have configured partitions, the pvcreate command will fail. If you wish to use the whole device rather than a partition, you must remove the existing partitions from the device with the "kpartx -d" and the fdisk commands.

Would that do it?


Comment 6 Steven J. Levine 2009-08-11 19:01:54 UTC
I have added the Note in command #5 to the 5.4 draft of the DM-Multipath document. It will be corrected when the RHEL 5.4 document is available.

Comment 9 Steven J. Levine 2009-09-03 16:08:34 UTC
I've opened Bug 517897 to pursue the issue of virtual machines further. With the release of RHEL 5.4, I'm closing this bug, since the original issued that opened it is addressed in the updated document.

Note You need to log in before you can comment on or make changes to this bug.