[PC-BSD Commits] r6312 - pcbsd/trunk/pc-sysinstall/backend
svn at pcbsd.org
svn at pcbsd.org
Mon Mar 1 10:24:24 PST 2010
Author: kris
Date: 2010-03-01 10:24:24 -0800 (Mon, 01 Mar 2010)
New Revision: 6312
Modified:
pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh
pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh
Log:
Updated pc-sysinstall, now we have options in config files to specify raidz / mirror configurations of
ZFS zpools
Modified: pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh 2010-03-01 16:55:51 UTC (rev 6311)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh 2010-03-01 18:24:24 UTC (rev 6312)
@@ -1,6 +1,54 @@
#!/bin/sh
# Functions related to disk operations using bsdlabel
+# On check on the disk-label line if we have any extra vars for this device
+# Only enabled for ZFS devices now, may add other xtra options in future for other FS's
+get_fs_line_xvars()
+{
+ ACTIVEDEV="${1}"
+ LINE="${2}"
+
+ echo $LINE | grep ' (' >/dev/null 2>/dev/null
+ if [ "$?" = "0" ] ; then
+
+ # See if we are looking for ZFS specific options
+ echo $LINE | grep '^ZFS' >/dev/null 2>/dev/null
+ if [ "$?" = "0" ] ; then
+ ZTYPE="NONE"
+ ZFSVARS="`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1`"
+
+ # Check if we are doing raidz setup
+ echo $ZFSVARS | grep "^raidz:" >/dev/null 2>/dev/null
+ if [ "$?" = "0" ] ; then
+ ZTYPE="raidz"
+ ZFSVARS="`echo $ZFSVARS | sed 's|raidz: ||g' | sed 's|raidz:||g'`"
+ fi
+
+ echo $ZFSVARS | grep "^mirror:" >/dev/null 2>/dev/null
+ if [ "$?" = "0" ] ; then
+ ZTYPE="mirror"
+ ZFSVARS="`echo $ZFSVARS | sed 's|mirror: ||g' | sed 's|mirror:||g'`"
+ fi
+
+ # Return the ZFS options
+ if [ "${ZTYPE}" = "NONE" ] ; then
+ VAR="${ACTIVEDEV} ${ZFSVARS}"
+ else
+ VAR="${ZTYPE} ${ACTIVEDEV} ${ZFSVARS}"
+ fi
+ export VAR
+ return
+ fi # End of ZFS block
+
+
+ fi # End of xtra-options block
+
+ # If we got here, set VAR to empty and export
+ VAR=""
+ export VAR
+ return
+};
+
# Function which creates a unique label name for the specified mount
gen_glabel_name()
{
@@ -154,9 +202,13 @@
# Generate a unique label name for this mount
gen_glabel_name "${MNT}" "${FS}"
PLABEL="${VAL}"
+
+ # Get any extra options for this fs / line
+ get_fs_line_xvars "${WRKSLICE}${PARTLETTER}" "${STRING}"
+ XTRAOPTS="${VAR}"
# Save this data to our partition config dir
- echo "${FS}:${MNT}:${ENC}:${PLABEL}:MBR" >${PARTDIR}/${WRKSLICE}${PARTLETTER}
+ echo "${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}" >${PARTDIR}/${WRKSLICE}${PARTLETTER}
# This partition letter is used, get the next one
case ${PARTLETTER} in
@@ -275,12 +327,18 @@
gen_glabel_name "${MNT}" "${FS}"
PLABEL="${VAL}"
+ # Get any extra options for this fs / line
+ get_fs_line_xvars "${DISK}p${CURPART}" "${STRING}"
+ XTRAOPTS="${VAR}"
+
+ # Figure out the gpart type to use
case ${FS} in
ZFS) PARTYPE="freebsd-zfs" ;;
SWAP) PARTYPE="freebsd-swap" ;;
*) PARTYPE="freebsd-ufs" ;;
esac
+ # Create the partition
rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${DISK}"
# Check if this is a root / boot partition, and stamp the right loader
@@ -295,7 +353,7 @@
done
# Save this data to our partition config dir
- echo "${FS}:${MNT}:${ENC}:${PLABEL}:GPT" >${PARTDIR}/${DISK}p${CURPART}
+ echo "${FS}:${MNT}:${ENC}:${PLABEL}:GPT:${XTRAOPTS}" >${PARTDIR}/${DISK}p${CURPART}
# Increment our parts counter
CURPART="`expr ${CURPART} + 1`"
Modified: pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh 2010-03-01 16:55:51 UTC (rev 6311)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh 2010-03-01 18:24:24 UTC (rev 6312)
@@ -10,13 +10,19 @@
PARTMNT="$3"
EXT="$4"
PARTGEOM="$5"
+ ZPOOLOPTS="$6"
ROOTSLICE="`echo ${PART} | rev | cut -b 2- | rev`"
get_zpool_name "${PART}"
ZPOOLNAME="${VAL}"
+ # 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}"
+ else
+ # No zpool options, create pool on single device
+ rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}"
+ fi
- rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}"
-
# Disable atime for this zfs partition, speed increase
rc_nohalt "zfs set atime=off ${ZPOOLNAME}"
@@ -63,6 +69,7 @@
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
PARTGEOM="`cat ${PARTDIR}/${PART} | cut -d ':' -f 5`"
+ PARTXTRAOPTS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 6`"
# Make sure journaling isn't enabled on this device
if [ -e "/dev/${PART}.journal" ]
@@ -117,7 +124,7 @@
sleep 2
;;
ZFS) echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
- setup_zfs_filesystem "${PART}" "${PARTFS}" "${PARTMNT}" "${EXT}" "${PARTGEOM}"
+ setup_zfs_filesystem "${PART}" "${PARTFS}" "${PARTMNT}" "${EXT}" "${PARTGEOM}" "${PARTXTRAOPTS}"
;;
SWAP) rc_halt "sync"
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
More information about the Commits
mailing list