diff options
author | Luiz Souza <luiz@netgate.com> | 2018-09-29 20:04:41 -0300 |
---|---|---|
committer | Luiz Souza <luiz@netgate.com> | 2018-09-29 20:07:28 -0300 |
commit | bd7524d6b955d42e37214b25b04708faec699c55 (patch) | |
tree | 9f0119a48d007d42a2e7ffa65cbfc6dcb7bd62b5 | |
parent | 1d0ffd34da6d2e47f0d7b9b948fc354b4b870d34 (diff) | |
download | FreeBSD-src-bd7524d6b955d42e37214b25b04708faec699c55.zip FreeBSD-src-bd7524d6b955d42e37214b25b04708faec699c55.tar.gz |
Fix a warning in growfs. gpart commit is supposed to be called on disk device.
(cherry picked from commit 33976174adbd3f9d8ba61b2dbe904adb4a16f4ae)
-rwxr-xr-x | etc/rc.d/growfs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/etc/rc.d/growfs b/etc/rc.d/growfs index d296050..33cfc5f 100755 --- a/etc/rc.d/growfs +++ b/etc/rc.d/growfs @@ -46,6 +46,20 @@ start_cmd="growfs_start" stop_cmd=":" rcvar="growfs_enable" +growfs_get_diskdev () +{ + sysctl -b kern.geom.conftxt | + while read line + do + local _type=$(echo ${line} | awk '{printf $2}') + local _dev=$(echo ${line} | awk '{printf $3}') + if [ "${_type}" = "DISK" -a -n "$(echo ${1} | grep ${_dev})" ]; then + echo -n ${_dev} + break + fi + done +} + growfs_start () { echo "Growing root partition to fill device" @@ -67,6 +81,11 @@ growfs_start () search=$rawdev fi + diskdev=$(growfs_get_diskdev ${search}) + if [ -z "${diskdev" ]; then + diskdev=${rootdev} + fi + sysctl -b kern.geom.conftxt | awk ' { lvl=$1 @@ -96,7 +115,7 @@ growfs_start () exit 0 } }' dev="$search" - gpart commit "$rootdev" + gpart commit "$diskdev" growfs -y /dev/"$rootdev" } |