[PC-BSD Commits] r20165 - pcbsd/current/build-files/src-patches
svn at pcbsd.org
svn at pcbsd.org
Sat Nov 10 17:17:44 PST 2012
Author: kris
Date: 2012-11-11 01:17:44 +0000 (Sun, 11 Nov 2012)
New Revision: 20165
Modified:
pcbsd/current/build-files/src-patches/patch-pc-sysinstall-zpool-4k-gnop
Log:
Fix up the gnop patch to do ZFS mirror / raidz configurations
Modified: pcbsd/current/build-files/src-patches/patch-pc-sysinstall-zpool-4k-gnop
===================================================================
--- pcbsd/current/build-files/src-patches/patch-pc-sysinstall-zpool-4k-gnop 2012-11-11 00:30:36 UTC (rev 20164)
+++ pcbsd/current/build-files/src-patches/patch-pc-sysinstall-zpool-4k-gnop 2012-11-11 01:17:44 UTC (rev 20165)
@@ -1,3 +1,39 @@
+Index: usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
+===================================================================
+--- usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh (revision 242874)
++++ usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh (working copy)
+@@ -62,7 +62,18 @@
+ echo $ZFSVARS | grep -qE "^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache):" 2>/dev/null
+ if [ $? -eq 0 ] ; then
+ ZTYPE=`echo $ZFSVARS | cut -f1 -d:`
+- ZFSVARS=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"`
++ tmpVars=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"`
++ ZFSVARS=""
++ # make sure we have a '/dev' in front of the extra devices
++ for i in $tmpVars
++ do
++ echo $i | grep -q '/dev/'
++ if [ $? -ne 0 ] ; then
++ ZFSVARS="$ZFSVARS /dev/${i}"
++ else
++ ZFSVARS="$ZFSVARS $i"
++ fi
++ done
+ fi
+
+ # Return the ZFS options
+Index: usr.sbin/pc-sysinstall/backend/functions-disk.sh
+===================================================================
+--- usr.sbin/pc-sysinstall/backend/functions-disk.sh (revision 242874)
++++ usr.sbin/pc-sysinstall/backend/functions-disk.sh (working copy)
+@@ -33,6 +33,7 @@
+ for _dsk in `sysctl -n kern.disks`
+ do
+ [ "$_dsk" = "${1}" ] && return 0
++ [ "/dev/$_dsk" = "${1}" ] && return 0
+ done
+
+ return 1
Index: usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
===================================================================
--- usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh (revision 242874)
@@ -36,32 +72,61 @@
===================================================================
--- usr.sbin/pc-sysinstall/backend/functions-newfs.sh (revision 242874)
+++ usr.sbin/pc-sysinstall/backend/functions-newfs.sh (working copy)
-@@ -60,18 +60,28 @@
+@@ -60,18 +60,56 @@
fi
done
-+ # Lets do our pseudo-4k drive
-+ rc_halt "gnop create -S 4096 ${PART}${EXT}"
-
+-
# Check if we have some custom zpool arguments and use them if so
if [ ! -z "${ZPOOLOPTS}" ] ; then
- rc_halt "zpool create -m none -f ${ZPOOLNAME} ${ZPOOLOPTS}"
-+ echo_log "Creating zpool ${ZPOOLNAME} with $ZPOOLOPTS on ${PART}${EXT}"
-+ rc_halt "zpool create -m none -f ${ZPOOLNAME} ${ZPOOLOPTS} ${PART}${EXT}.nop"
++ # Sort through devices and run gnop on them
++ local gnopDev=""
++ local newOpts=""
++ for i in $ZPOOLOPTS
++ do
++ echo "$i" | grep -q '/dev/'
++ if [ $? -eq 0 ] ; then
++ rc_halt "gnop create -S 4096 ${i}"
++ gnopDev="$gnopDev $i"
++ newOpts="$newOpts ${i}.nop"
++ else
++ newOpts="$newOpts $i"
++ fi
++ done
++
++ echo_log "Creating zpool ${ZPOOLNAME} with $newOpts"
++ rc_halt "zpool create -m none -f ${ZPOOLNAME} ${newOpts}"
++
++ # Export the pool
++ rc_halt "zpool export ${ZPOOLNAME}"
++
++ # Destroy the gnop devices
++ for i in $gnopDev
++ do
++ rc_halt "gnop destroy ${i}.nop"
++ done
++
++ # And lastly re-import the pool
++ rc_halt "zpool import ${ZPOOLNAME}"
else
++ # Lets do our pseudo-4k drive
++ rc_halt "gnop create -S 4096 ${PART}${EXT}"
++
# No zpool options, create pool on single device
- rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}"
+ echo_log "Creating zpool ${ZPOOLNAME} on ${PART}${EXT}"
+ rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}.nop"
++
++ # Finish up the gnop 4k trickery
++ rc_halt "zpool export ${ZPOOLNAME}"
++ rc_halt "gnop destroy ${PART}${EXT}.nop"
++ rc_halt "zpool import ${ZPOOLNAME}"
fi
# Disable atime for this zfs partition, speed increase
rc_nohalt "zfs set atime=off ${ZPOOLNAME}"
-+ # Finish up the gnop 4k trickery
-+ rc_halt "zpool export ${ZPOOLNAME}"
-+ rc_halt "gnop destroy ${PART}${EXT}.nop"
-+ rc_halt "zpool import ${ZPOOLNAME}"
+
+
};
More information about the Commits
mailing list