From: Christophe Varoqui Subject: Re: [PATCH] fix extended partition mapping Date: Sun, 06 Jan 2013 11:19:09 +0100 Message-ID: <1357467549.9240.5.camel@lapoo.opensvc.com> References: <1357441050-21997-1-git-send-email-psusi@ubuntu.com> Reply-To: christophe.varoqui@opensvc.com, device-mapper development Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1357441050-21997-1-git-send-email-psusi@ubuntu.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: device-mapper development List-Id: dm-devel.ids On sam., 2013-01-05 at 21:57 -0500, Phillip Susi wrote: > The linux kernel maps the extended partition only > so that LILO can be installed there. The length is always set > to two sectors to allow this, and most tools know to ignore the > device. kpartx was mapping the entire extended partition, then > stacking the logical partitions on top of it. This presented > a device that looked like an entirely separate disk that > contains only the logical partitions. This patch fixes kpartx > to conform with the normal Linux behavior. Applied. Thanks. > --- > kpartx/dos.c | 2 ++ > kpartx/kpartx.c | 9 +++------ > 2 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/kpartx/dos.c b/kpartx/dos.c > index 1691105..a1a9961 100644 > --- a/kpartx/dos.c > +++ b/kpartx/dos.c > @@ -98,6 +98,8 @@ read_dos_pt(int fd, struct slice all, struct slice *sp, int ns) { > break; > } > if (is_extended(p.sys_type)) { > + sp[i].size = 2; /* extended partitions only get two > + sectors mapped for LILO to install */ > n += read_extended_partition(fd, &p, i, sp+n, ns-n); > } > } > diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c > index b5e0a32..f359afe 100644 > --- a/kpartx/kpartx.c > +++ b/kpartx/kpartx.c > @@ -515,7 +515,6 @@ main(int argc, char **argv){ > d = c; > while (c) { > for (j = 0; j < n; j++) { > - uint64_t start; > int k = slices[j].container - 1; > > if (slices[j].size == 0) > @@ -541,11 +540,9 @@ main(int argc, char **argv){ > } > strip_slash(partname); > > - start = slices[j].start - slices[k].start; > - if (safe_sprintf(params, "%d:%d %" PRIu64, > - slices[k].major, > - slices[k].minor, > - start)) { > + if (safe_sprintf(params, "%s %" PRIu64, > + device, > + slices[j].start)) { > fprintf(stderr, "params too small\n"); > exit(1); > }