NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

install/48304: 1st partition's offset is always 1MB



>Number:         48304
>Category:       install
>Synopsis:       1st partition's offset is always 1MB
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 12 15:30:00 +0000 2013
>Originator:     Simon Nicolussi
>Release:        6.1.2
>Organization:
>Environment:
NetBSD rocknroll.sinic.name 6.1.2 NetBSD 6.1.2 (GENERIC) amd64
>Description:
sysinst is supposed to behave just like fdisk when it comes to partition 
alignment, that is: "If the first partition isn't defined then the alignment 
and offset for disks larger than 128GB is set to 2048 (1MB). In all other cases 
the alignment default [sic] to a cylinder and the offset to a track (both using 
the BIOS geometry)."

The expected behaviour is also confirmed by a source code comment in sysinst's 
mbr.c: "/* Use 1MB offset for large (>128GB) disks */"

Unfortunately the if clause below that comment is missing braces around the 
statements that set the alignment and offset, so the latter is set 
unconditionally.
>How-To-Repeat:
Start the installation process on a machine with a disk smaller than 128GB. The 
disk's MBR should be zeroed out, as not to give sysinst any data to reuse.

Go with the defaults. When presented with the final BSD disklabel partitioning 
overview, observe that partition a starts at sector 2048 instead of at sector 
63.
>Fix:
Index: mbr.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/mbr.c,v
retrieving revision 1.89.2.2
diff -u -r1.89.2.2 mbr.c
--- mbr.c       12 Jun 2012 19:19:20 -0000      1.89.2.2
+++ mbr.c       10 Oct 2013 20:12:56 -0000
@@ -1888,10 +1888,7 @@
                                ptn_0_offset = ptn_0_base;
                        }
                }
-       } else {
+       } else if (dlsize > 2048 * 1024 * 128)
                /* Use 1MB offset for large (>128GB) disks */
-               if (dlsize > 2048 * 1024 * 128)
-                       ptn_alignment = 2048;
-                       ptn_0_offset = 2048;
-       }
+               ptn_alignment = ptn_0_offset = 2048;
 }



Home | Main Index | Thread Index | Old Index