Bug 475283 - kpartx tries to create devices beyond the end of the disk.
Summary: kpartx tries to create devices beyond the end of the disk.
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: device-mapper-multipath
Version: rawhide
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: Milan Broz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 479116 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-12-08 19:34 UTC by Nate Clark
Modified: 2013-03-01 04:07 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-03-06 13:16:06 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Subtracts the start of the extended partition from the overall volume offset. (470 bytes, patch)
2008-12-08 19:38 UTC, Nate Clark
no flags Details | Diff
Proposed patch (916 bytes, patch)
2009-03-06 12:48 UTC, Milan Broz
no flags Details | Diff

Description Nate Clark 2008-12-08 19:34:48 UTC
Description of problem:
kpartx when trying to create the corresponding linear devices on a dos partition with an extended partition fails. This is occurring because kpartx creates partitions that are inside a logical partition on top of the device that represents the extended partition.  The problem comes from the fact that when this is done instead of changing the offset of the partition to the start of the extended partition it continues to use the offset from the beginning of the entire volume.

Example DOS MBR:
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       32, size=   206816, Id=83
/dev/sda2 : start=   206848, size=   206848, Id=83
/dev/sda3 : start=   413696, size=  6293504, Id=82
/dev/sda4 : start=  6707200, size= 56207360, Id= 5
/dev/sda5 : start=  6707232, size=  5244896, Id=83
/dev/sda6 : start= 11952160, size=  5244896, Id=83
/dev/sda7 : start= 17197088, size= 22022112, Id=83
/dev/sda8 : start= 39219232, size= 22022112, Id=83

bad dmtable made by kpartx:
mpath0p7: 0 22022112 linear 253:4 22442080
mpath0p6: 0 5244896 linear 253:4 11952192
mpath0p5: 0 5244896 linear 253:4 6707232
mpath0p4: 0 56207360 linear 253:0 6707200
mpath0p3: 0 6293504 linear 253:0 413696
mpath0p2: 0 206848 linear 253:0 206848
mpath0p1: 0 206816 linear 253:0 32

Corrected dmtable:
archive0p8: 0 22022112 linear 253:4 32512032
archive0p7: 0 22022112 linear 253:4 10489888
archive0p6: 0 5244896 linear 253:4 5244960
archive0p5: 0 5244896 linear 253:4 32
archive0p4: 0 56207360 linear 253:0 6707200
archive0p3: 0 6293504 linear 253:0 413696
archive0p2: 0 206848 linear 253:0 206848
archive0p1: 0 206816 linear 253:0 32

Attached is a patch which I used to work around this problem. So far it has worked for me.

Version-Release number of selected component (if applicable):
device-mapper-multipath-0.4.8-7.fc10.i386

How reproducible: 100%


Steps to Reproduce:
1. Create a partition table with extended partitions on a multipath device
2. Execute "kpartx -a <mpathdev>"
  
Actual results:
Fails to create some of the partitions.

Expected results:
Partitions created as linear device mapper devs.

Additional info:

Comment 1 Nate Clark 2008-12-08 19:38:45 UTC
Created attachment 326169 [details]
Subtracts the start of the extended partition from the overall volume offset.

Patch mentioned in description.

Comment 2 Heinz Mauelshagen 2009-01-09 15:21:12 UTC
*** Bug 479116 has been marked as a duplicate of this bug. ***

Comment 3 Nicolas Chauvet (kwizart) 2009-01-26 16:50:54 UTC
Is there any improvements about how to fix this bug ?
Because this is really weird that it was working previously without the patch !!!
Or the problem might be elsewhere ?

Comment 4 Nate Clark 2009-01-26 17:08:48 UTC
I think this use to work in previous versions of kpartx because all dm-linear devices use to sit on top of the same device. In this version only primary partitions sit on top of the base device and extended partitions sit on top of the appropriate partition.

Comment 5 Nicolas Chauvet (kwizart) 2009-03-05 11:52:36 UTC
This patch is still needed in current rawhide !
Any chances of it to be fixed by the F-11 beta ?

Comment 6 Milan Broz 2009-03-06 12:45:46 UTC
Ok, that's apparently serious problem, I'll fix that in rawhide.

Comment 7 Milan Broz 2009-03-06 12:48:04 UTC
Created attachment 334287 [details]
Proposed patch

(patch from Hannes who originally added that code to kpartx - not sure why it is missing there)

Comment 8 Milan Broz 2009-03-06 13:16:06 UTC
Fixed in device-mapper-multipath-0.4.8-9.fc11 build.


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