Bug 466970 - pvcreate on /dev/mapper/mpathX does not work. Works on on mpathXpY however
pvcreate on /dev/mapper/mpathX does not work. Works on on mpathXpY however
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: device-mapper (Show other bugs)
5.2
All Linux
medium Severity medium
: rc
: ---
Assigned To: Steven J. Levine
Cluster QE
:
Depends On:
Blocks: 517897
  Show dependency treegraph
 
Reported: 2008-10-14 16:00 EDT by John DeFranco
Modified: 2013-05-22 15:15 EDT (History)
15 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 517897 (view as bug list)
Environment:
Last Closed: 2009-09-03 12:08:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John DeFranco 2008-10-14 16:00:49 EDT
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:
Always.

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


Expected results:


Additional info:
Comment 1 Christophe Varoqui 2008-10-14 17:13:36 EDT
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 17:25:23 EDT
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
device).

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 17:51:01 EDT
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 10:18:46 EDT
Assigning to the documentation team.  I couldn't hurt to mention this...
Comment 5 Steven J. Levine 2009-06-26 12:30:51 EDT
On June 16 I sent this note to Jonathan Brassow:

Jonathan:

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:

http://documentation-stage.bne.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/DM_Multipath/multipath_logical_volumes.html

The Note would say something like:

Note:
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?

-Steven
Comment 6 Steven J. Levine 2009-08-11 15:01:54 EDT
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 12:08:34 EDT
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.