[PC-BSD Commits] r6514 - pcbsd/trunk/pc-sysinstall/backend-partmanager

svn at pcbsd.org svn at pcbsd.org
Tue Apr 6 15:19:25 PDT 2010


Author: kris
Date: 2010-04-06 15:19:25 -0700 (Tue, 06 Apr 2010)
New Revision: 6514

Modified:
   pcbsd/trunk/pc-sysinstall/backend-partmanager/create-part.sh
Log:

Fixed bug creating slices, may need to init with gpart first on completely empty disk



Modified: pcbsd/trunk/pc-sysinstall/backend-partmanager/create-part.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend-partmanager/create-part.sh	2010-04-06 19:34:31 UTC (rev 6513)
+++ pcbsd/trunk/pc-sysinstall/backend-partmanager/create-part.sh	2010-04-06 22:19:25 UTC (rev 6514)
@@ -26,7 +26,7 @@
 
 
 # Lets figure out what number this slice will be
-LASTSLICE="`fdisk -s /dev/${DISK} | grep -v ${DISK} | grep ':' | tail -n 1 | cut -d ':' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
+LASTSLICE="`fdisk -s /dev/${DISK} 2>/dev/null | grep -v ${DISK} | grep ':' | tail -n 1 | cut -d ':' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
 if [ -z "${LASTSLICE}" ] ; then
   LASTSLICE="1"
 else
@@ -56,5 +56,11 @@
 fi
 
 
+# If this is an empty disk, see if we need to create a new MBR scheme for it
+gpart show ${DISK} >/dev/null 2>/dev/null
+if [ "$?" != "0" -a "${SLICENUM}" = "1" ] ; then
+ gpart create -s mbr ${DISK}
+fi
+
 gpart add -b ${STARTBLOCK} -s ${TOTALBLOCKS} -t freebsd -i ${SLICENUM} ${DISK}
 exit "$?"



More information about the Commits mailing list