diff mbox

kpartx: fix extended partition size for >512b sectors

Message ID 1402327498-19669-1-git-send-email-psusi@ubuntu.com (mailing list archive)
State Accepted, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Phillip Susi June 9, 2014, 3:24 p.m. UTC
Extended partitions only get 2 sectors for 512 byte sector size,
to allow LILO the 1024 bytes of room it needs.  Larger sector size
disks already have room and so only use 1 sector.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
---
 kpartx/dos.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Christophe Varoqui June 10, 2014, 5:59 a.m. UTC | #1
Applied, thanks

Christophe Varoqui
www.opensvc.com


On Mon, Jun 9, 2014 at 5:24 PM, Phillip Susi <psusi@ubuntu.com> wrote:

> Extended partitions only get 2 sectors for 512 byte sector size,
> to allow LILO the 1024 bytes of room it needs.  Larger sector size
> disks already have room and so only use 1 sector.
>
> Signed-off-by: Phillip Susi <psusi@ubuntu.com>
> ---
>  kpartx/dos.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kpartx/dos.c b/kpartx/dos.c
> index 0e57f0e..90ad3bd 100644
> --- a/kpartx/dos.c
> +++ b/kpartx/dos.c
> @@ -101,8 +101,12 @@ read_dos_pt(int fd, struct slice all, struct slice
> *sp, int ns) {
>                         break;
>                 }
>                 if (is_extended(p.sys_type)) {
> -                       sp[i].size = sector_size_mul * 2; /* extended
> partitions only get two
> -                                          sectors mapped for LILO to
> install */
> +                       /* extended partitions only get one or
> +                          two sectors mapped for LILO to install,
> +                          whichever is needed to have 1kb of space */
> +                       if (sector_size_mul == 1)
> +                               sp[i].size = 2;
> +                       else sp[i].size = sector_size_mul;
>                         n += read_extended_partition(fd, &p, i, sp+n,
> ns-n);
>                 }
>         }
> --
> 1.9.1
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/kpartx/dos.c b/kpartx/dos.c
index 0e57f0e..90ad3bd 100644
--- a/kpartx/dos.c
+++ b/kpartx/dos.c
@@ -101,8 +101,12 @@  read_dos_pt(int fd, struct slice all, struct slice *sp, int ns) {
 			break;
 		}
 		if (is_extended(p.sys_type)) {
-			sp[i].size = sector_size_mul * 2; /* extended partitions only get two
-					   sectors mapped for LILO to install */
+			/* extended partitions only get one or
+			   two sectors mapped for LILO to install,
+			   whichever is needed to have 1kb of space */
+			if (sector_size_mul == 1)
+				sp[i].size = 2;
+			else sp[i].size = sector_size_mul;
 			n += read_extended_partition(fd, &p, i, sp+n, ns-n);
 		}
 	}