[dm-devel] [PATCH] multipath-tools: Fix kpartx partition calculation for DASD partitions.

Stefan Bader Stefan.Bader at de.ibm.com
Mon Dec 11 16:28:07 UTC 2006


We found an error in the partition calculation of DASD devices. This
only applies to DASDs with CMS, LNX (old linux disk layout) and
unpartitioned devices. In these cases the partition created by kpartx
is smaller than the partion that would be accessible through the kernel
partition device. If 512B blocksize was used when formatting the DASD
the calculations are ok. The partitions are also ok if the default
(Compatible Disk Layout) was used.

BIG WARNING:
The following fix will correct this (and it should be done so kernel
and kpartx partitions are the same). However, if someone has already
used the disk layouts mentioned above and wrote data to the
partitions created by kpartx this will lead to trouble!
The data won't be found at the new start of the partition. But a
manually created linear target might be used to access the data and
move it somewhere else.

echo "0 <size> <device> <offset>" | dmsetup create <name>

<device> = /dev/dasd[a-z][a-z]*
<f>      = 8 (for 4K blocksize), 4 (2K BS), 2 (1K BS)
<size>   = $(blockdev --getsize <device>) - (3 * f) - (3 * f * f)
<offset> = 3 * f * f

To check if someone is affected by the bug the output of
"kpartx -l <device>" can be compared against the start and size
attribute in /sys/block/<devicename>/<devicename>1.
(e.g. "kpartx -l /dev/dasdb" <--> cat /sys/block/dasdb/dasdb1/...)

Stefan Bader

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mptools-kpartx-dasd.patch
Type: application/octet-stream
Size: 2971 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20061211/0ffeff69/attachment.obj>


More information about the dm-devel mailing list