From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 23:07:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 327E796D; Sun, 3 Mar 2013 23:07:29 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0B84CDC5; Sun, 3 Mar 2013 23:07:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23N7S5u024049; Sun, 3 Mar 2013 23:07:28 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23N7RXa024039; Sun, 3 Mar 2013 23:07:27 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201303032307.r23N7RXa024039@svn.freebsd.org> From: Josh Paetzel Date: Sun, 3 Mar 2013 23:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247735 - in head/usr.sbin/pc-sysinstall: backend conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 23:07:29 -0000 Author: jpaetzel Date: Sun Mar 3 23:07:27 2013 New Revision: 247735 URL: http://svnweb.freebsd.org/changeset/base/247735 Log: Use GNOP to force ZFS pools to 4k. Obtained from: PC-BSD Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh head/usr.sbin/pc-sysinstall/backend/functions-disk.sh head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh head/usr.sbin/pc-sysinstall/backend/functions.sh head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -62,7 +62,18 @@ get_fs_line_xvars() 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 Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -33,6 +33,7 @@ is_disk() for _dsk in `sysctl -n kern.disks` do [ "$_dsk" = "${1}" ] && return 0 + [ "/dev/$_dsk" = "${1}" ] && return 0 done return 1 Modified: head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -149,12 +149,12 @@ mount_all_filesystems() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - if [ ! -e "${PARTDEV}" ] + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + if [ ! -e "${PARTDEV}" -a "${PARTFS}" != "ZFS" ] then exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" fi - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" @@ -186,12 +186,12 @@ mount_all_filesystems() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - if [ ! -e "${PARTDEV}" ] + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + if [ ! -e "${PARTDEV}" -a "${PARTFS}" != "ZFS" ] then exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" fi - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" Modified: head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -60,18 +60,56 @@ setup_zfs_filesystem() fi done - # 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}" + # 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}" + + }; # Runs newfs on all the partiions which we've setup with bsdlabel Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -277,7 +277,11 @@ get_zpool_name() while : do NEWNAME="${BASENAME}${NUM}" - zpool import | grep -qw "${NEWNAME}" || break + zpool list | grep -qw "${NEWNAME}" + local chk1=$? + zpool import | grep -qw "${NEWNAME}" + local chk2=$? + if [ $chk1 -eq 1 -a $chk2 -eq 1 ] ; then break ; fi NUM=$((NUM+1)) done Modified: head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf ============================================================================== --- head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf Sun Mar 3 23:07:27 2013 (r247735) @@ -5,11 +5,9 @@ TMPDIR="/tmp/.pc-sysinstall" export TMPDIR -if [ ! -d "${TMPDIR}" ] -then - mkdir -p ${TMPDIR} - chmod 777 ${TMPDIR} -fi +# Create a fresh TMPDIR +if [ -d "${TMPDIR}" -a "$TMPDIR" != '/' ]; then rm -rf ${TMPDIR}; fi +mkdir -p ${TMPDIR} # Set our temp directory for storing partition information PARTDIR="${TMPDIR}/part-info"