diff options
| author | Colin Percival <cperciva@FreeBSD.org> | 2019-02-08 19:19:31 +0000 |
|---|---|---|
| committer | Colin Percival <cperciva@FreeBSD.org> | 2019-02-08 19:19:31 +0000 |
| commit | efed7c6db7bfcd15886fc93637a5b4a57ec95bf6 (patch) | |
| tree | 0f30d5b45856e7a40e4829f03c85df45dde898c7 /libexec | |
| parent | bc8fc0070581bd8da5386dc224c73d9956897c26 (diff) | |
Notes
Diffstat (limited to 'libexec')
| -rwxr-xr-x | libexec/rc/rc.d/growfs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/libexec/rc/rc.d/growfs b/libexec/rc/rc.d/growfs index 9b69eb6b3520..98f1d9b649c1 100755 --- a/libexec/rc/rc.d/growfs +++ b/libexec/rc/rc.d/growfs @@ -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 |
