Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2012 21:41:30 +0000 (UTC)
From:      Josh Paetzel <jpaetzel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232901 - head/usr.sbin/pc-sysinstall/backend
Message-ID:  <201203122141.q2CLfUu2088344@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203122141.q2CLfUu2088344>