Bug 187781 - kpartx: can not cleanly delete partition mapping
kpartx: can not cleanly delete partition mapping
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: device-mapper-multipath (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Alasdair Kergon
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-03 12:03 EDT by Eddie Williams
Modified: 2010-01-11 21:24 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-04-20 16:27:00 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 Eddie Williams 2006-04-03 12:03:46 EDT
Description of problem:  With Red Hatl EL 4 Update 3 the system is automatically
loading the partition tables with kpartx during bootup.  However the partition
delimiters that are being created are not always what I want.  I want the
delimiter to have a "p", aka /dev/mapper/[uuid]p#.  I find some of my partitions
are created with no delimiter, aka /dev/mapper/[uuid]#.  I can delete the the
partition mapping (kpartx -d /dev/mapper/[uuid]) where the partition nodes are
removed (/dev/mapper/[uuid]#).  I am then able to create the mappings that I
like with the 'p' delimiter.  If I then try to delete the mappings again (kpartx
-d /dev/mapper/[uuid]) the partition nodes are not removed, aka
/dev/mapper/[uuid]p# is not removed.

I am trying to determine why the partitions are not always created with the 'p'
delimiter so I am running the commands multiple times trying to trace where it
is causing the "default" behavior.



Version-Release number of selected component (if applicable):
device-mapper-multipath-0.4.5-12.0.RHEL4
device-mapper-1.02.02-3.0.RHEL4

How reproducible:
every time

Steps to Reproduce:
1. kpartx -d /dev/mapper/[uuid]
2. kpartx -a -p 'p' /dev/mapper/[uuid]
3. kpartx -d /dev/mapper/[uuid]
  
Actual results:
$ ls -l /dev/mapper/3600508b300902930a70a82d7daac002c*
brw-rw----  1 root disk 253, 11 Apr  3 11:09
/dev/mapper/3600508b300902930a70a82d7daac002c
brw-rw----  1 root disk 253, 46 Apr  3 11:09
/dev/mapper/3600508b300902930a70a82d7daac002c1

$ kpartx -d /dev/mapper/3600508b300902930a70a82d7daac002c
$ ls -l /dev/mapper/3600508b300902930a70a82d7daac002c*
brw-rw----  1 root disk 253, 11 Apr  3 11:09
/dev/mapper/3600508b300902930a70a82d7daac002c

$ kpartx -a -p 'p' /dev/mapper/3600508b300902930a70a82d7daac002c
$ ls -l /dev/mapper/3600508b300902930a70a82d7daac002c*
brw-rw----  1 root disk 253, 11 Apr  3 11:09
/dev/mapper/3600508b300902930a70a82d7daac002c
brw-rw----  1 root disk 253, 46 Apr  3 12:06
/dev/mapper/3600508b300902930a70a82d7daac002cp1

$ kpartx -d /dev/mapper/3600508b300902930a70a82d7daac002c
$ ls -l /dev/mapper/3600508b300902930a70a82d7daac002c*
brw-rw----  1 root disk 253, 11 Apr  3 11:09
/dev/mapper/3600508b300902930a70a82d7daac002c
brw-rw----  1 root disk 253, 46 Apr  3 12:06
/dev/mapper/3600508b300902930a70a82d7daac002cp1


Expected results:
I expected the second kpartx -d to remove the partition table and leave only the
device node for the full disk.

Additional info:
Comment 1 Ben Marzinski 2006-04-20 16:27:00 EDT
By default, kpartx should insert a 'p' as a delimiter if the last charater in
the device name is a number, otherwise it should use no delimiter. If you
manually specified the partition delimiter when you created the device, you must
also specify it when you remove the partition.

So instead of running
$ kpartx -d /dev/mapper/3600508b300902930a70a82d7daac002c
run
$ kpartx -d -p 'p' /dev/mapper/3600508b300902930a70a82d7daac002c

If this is not the way that kpartx is working for you, please reopen the bug.
Comment 2 Ben Marzinski 2006-04-20 17:19:42 EDT
Oh yeah, and if you want multipath to automatically create partitions with the 'p'
delimiter, you can just modify the kpartx call in /etc/dev.d/block/multipath.dev

When you remove the device with 'multipath -f', the partition will be removed as
well, regardless of the delimiter.

Also, you can use the user_friendly_names config file option to give the
multipath devices names like mpath1, mpath2, etc.  Since these names will always
end in a number, the partitions will always have a 'p' delimiter in them. Also,
these names are easier to remember and type out. However, while the mappings are
persistent, they may be different across machines (for instance, say that mpath1
refers to the device formerly named 3600508b300902930a70a82d7daac002c on node1.
While this will always be true on node1, on node2 it might be mpath2 that refers
to the device named 3600508b300902930a70a82d7daac002c) To avoid this, after all
the devices have been named by multipath, copy the /var/lib/multipath/bindings
file from one machine to the others. then these bindings will be consistent
across machines.

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