From owner-svn-src-head@FreeBSD.ORG Mon Mar 12 21:41:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66614106566C; Mon, 12 Mar 2012 21:41:30 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 517D28FC1C; Mon, 12 Mar 2012 21:41:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2CLfUnU088347; Mon, 12 Mar 2012 21:41:30 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2CLfUu2088344; Mon, 12 Mar 2012 21:41:30 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203122141.q2CLfUu2088344@svn.freebsd.org> From: Josh Paetzel Date: Mon, 12 Mar 2012 21:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232901 - head/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2012 21:41:30 -0000 Author: jpaetzel Date: Mon Mar 12 21:41:29 2012 New Revision: 232901 URL: http://svn.freebsd.org/changeset/base/232901 Log: Use gpart "-a" flag to 4k alignment. Submitted by: kris Obtained from: PC-BSD Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 12 21:34:10 2012 (r232900) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 12 21:41:29 2012 (r232901) @@ -314,7 +314,7 @@ setup_gpart_partitions() if [ "$CURPART" = "2" ] ; then # If this is GPT, make sure first partition is aligned to 4k sleep 2 - rc_halt "gpart add -b 2016 ${SOUT} -t ${PARTYPE} ${_pDisk}" + rc_halt "gpart add -a 4k ${SOUT} -t ${PARTYPE} ${_pDisk}" else sleep 2 rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}" Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 12 21:34:10 2012 (r232900) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 12 21:41:29 2012 (r232901) @@ -645,33 +645,9 @@ init_mbr_full_disk() echo_log "Running gpart on ${_intDISK}" rc_halt "gpart create -s mbr -f active ${_intDISK}" - # Lets figure out disk size in blocks - # Get the cyl of this disk - get_disk_cyl "${_intDISK}" - cyl="${VAL}" - - # Get the heads of this disk - get_disk_heads "${_intDISK}" - head="${VAL}" - - # Get the tracks/sectors of this disk - get_disk_sectors "${_intDISK}" - sec="${VAL}" - - # Multiply them all together to get our total blocks - totalblocks="`expr ${cyl} \* ${head} 2>/dev/null`" - totalblocks="`expr ${totalblocks} \* ${sec} 2>/dev/null`" - if [ -z "${totalblocks}" ] - then - totalblocks=`gpart show "${_intDISK}"|tail -2|head -1|awk '{ print $2 }'` - fi - - # Now set the ending block to the total disk block size - sizeblock="`expr ${totalblocks} - ${startblock}`" - # Install new partition setup echo_log "Running gpart add on ${_intDISK}" - rc_halt "gpart add -b ${startblock} -s ${sizeblock} -t freebsd -i 1 ${_intDISK}" + rc_halt "gpart add -a 4k -t freebsd -i 1 ${_intDISK}" sleep 2 echo_log "Cleaning up ${_intDISK}s1" @@ -847,44 +823,9 @@ run_gpart_free() rc_halt "gpart create -s mbr ${DISK}" fi - # Lets get the starting block first - if [ "${slicenum}" = "1" ] - then - startblock="63" - else - # Lets figure out where the prior slice ends - checkslice=$((slicenum-1)) - - # Get starting block of this slice - sblk=`gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | sed '/^$/d' | grep " ${checkslice} " | cut -d ' ' -f 2` - blksize=`gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | sed '/^$/d' | grep " ${checkslice} " | cut -d ' ' -f 3` - startblock=$((sblk+blksiz)) - fi - - # No slice after the new slice, lets figure out the free space remaining and use it - # Get the cyl of this disk - get_disk_cyl "${DISK}" - cyl="${VAL}" - - # Get the heads of this disk - get_disk_heads "${DISK}" - head="${VAL}" - - # Get the tracks/sectors of this disk - get_disk_sectors "${DISK}" - sec="${VAL}" - - # Multiply them all together to get our total blocks - totalblocks=$((cyl*head)) - totalblocks=$((totalblocks*sec)) - - - # Now set the ending block to the total disk block size - sizeblock=$((totalblocks-startblock)) - # Install new partition setup echo_log "Running gpart on ${DISK}" - rc_halt "gpart add -b ${startblock} -s ${sizeblock} -t freebsd -i ${slicenum} ${DISK}" + rc_halt "gpart add -a 4k -t freebsd -i ${slicenum} ${DISK}" sleep 2 echo_log "Cleaning up $slice"