Date: Sat, 16 Feb 2019 09:50:17 +0000 (UTC) From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r344210 - stable/12/libexec/rc/rc.d Message-ID: <201902160950.x1G9oHDs060771@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cperciva Date: Sat Feb 16 09:50:17 2019 New Revision: 344210 URL: https://svnweb.freebsd.org/changeset/base/344210 Log: MFC r343918: Teach /etc/rc.d/growfs how to handle systems running ZFS. Modified: stable/12/libexec/rc/rc.d/growfs Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/growfs ============================================================================== --- stable/12/libexec/rc/rc.d/growfs Sat Feb 16 06:12:16 2019 (r344209) +++ stable/12/libexec/rc/rc.d/growfs Sat Feb 16 09:50:17 2019 (r344210) @@ -49,7 +49,20 @@ rcvar="growfs_enable" growfs_start () { echo "Growing root partition to fill device" - rootdev=$(df / | tail -n 1 | awk '{ sub("/dev/", "", $1); print $1 }') + FSTYPE=$(mount -p | awk '{ if ( $2 == "/") { print $3 }}') + FSDEV=$(mount -p | awk '{ if ( $2 == "/") { print $1 }}') + case "$FSTYPE" in + ufs) + rootdev=${FSDEV#/dev/} + ;; + zfs) + pool=${FSDEV%%/*} + rootdev=$(zpool list -v $pool | tail -n 1 | awk '{ print $1 }') + ;; + *) + echo "Don't know how to grow root filesystem type: $FSTYPE" + return + esac if [ x"$rootdev" = x"${rootdev%/*}" ]; then # raw device rawdev="$rootdev" @@ -91,7 +104,14 @@ growfs_start () } }' dev="$rawdev" gpart commit "$rootdev" - growfs -y /dev/"$rootdev" + case "$FSTYPE" in + ufs) + growfs -y /dev/"$rootdev" + ;; + zfs) + zpool online -e $pool $rootdev + ;; + esac } load_rc_config $name
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902160950.x1G9oHDs060771>