Author: allanjude
Date: Sat Jan 16 19:25:16 2016
New Revision: 294191
URL: https://svnweb.freebsd.org/changeset/base/294191

Log:
  Never 4k align the MBR bootpool because zfsldr can not deal with a gap
  
  If the bootpool does not start at the first sector of the BSD partition
  then zfsldr seeks to the wrong offset inside the ZFS vdev label, and is
  unable to find zfsboot, so the system does not boot
  
  If 4k alignment is requested, align the BSD partition in the MBR table,
  and align the swap and data pool, but the bootpool must start at sector 1
  
  While here, if 4k alignment is requested, disable MBR CHS alignment, as
  this results in not-4k aligned partitions.
  
  Reported by:  Alex Wilkinson
  MFC after:    5 days
  Sponsored by: ScaleEngine Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/zfsboot    Sat Jan 16 19:06:12 2016        
(r294190)
+++ head/usr.sbin/bsdinstall/scripts/zfsboot    Sat Jan 16 19:25:16 2016        
(r294191)
@@ -825,6 +825,7 @@ zfs_create_diskpart()
        if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then
                align_small="-a 4k"
                align_big="-a 1m"
+               sysctl kern.geom.part.mbr.enforce_chs=0
        fi
 
        case "$ZFSBOOT_PARTITION_SCHEME" in
@@ -940,11 +941,12 @@ zfs_create_diskpart()
 
                #
                # Always prepare a boot pool on MBR
+               # Do not align this partition, there must not be a gap
                #
                ZFSBOOT_BOOT_POOL=1
                f_eval_catch $funcname gpart \
                             "$GPART_ADD_ALIGN_INDEX_WITH_SIZE" \
-                            "$align_small" 1 freebsd-zfs ${bootsize}b 
${disk}s1 ||
+                            "" 1 freebsd-zfs ${bootsize}b ${disk}s1 ||
                             return $FAILURE
                # Pedantically nuke any old labels
                f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to