Date: Mon, 19 Mar 2012 23:28:13 +0000 (UTC) From: Josh Paetzel <jpaetzel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r233226 - stable/9/usr.sbin/pc-sysinstall/backend Message-ID: <201203192328.q2JNSDj7091923@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jpaetzel Date: Mon Mar 19 23:28:13 2012 New Revision: 233226 URL: http://svn.freebsd.org/changeset/base/233226 Log: MFC: 232901 Use gpart "-a" flag to 4k alignment. Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 19 23:25:10 2012 (r233225) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Mar 19 23:28:13 2012 (r233226) @@ -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: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:25:10 2012 (r233225) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:28:13 2012 (r233226) @@ -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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203192328.q2JNSDj7091923>