Index: stable/10/etc/rc.d/Makefile =================================================================== --- stable/10/etc/rc.d/Makefile (revision 284008) +++ stable/10/etc/rc.d/Makefile (revision 284009) @@ -1,288 +1,289 @@ # $FreeBSD$ .include FILES= DAEMON \ FILESYSTEMS \ LOGIN \ NETWORKING \ SERVERS \ abi \ addswap \ adjkerntz \ archdep \ atm1 \ atm2 \ atm3 \ auditd \ auditdistd \ bgfsck \ ${_bluetooth} \ bridge \ ${_bthidd} \ cleanvar \ cleartmp \ cron \ ctld \ ddb \ defaultroute \ devd \ devfs \ dhclient \ dmesg \ dumpon \ faith \ fsck \ gbde \ geli \ geli2 \ gptboot \ + growfs \ gssd \ ${_hcsecd} \ hostid \ hostid_save \ hostname \ initrandom \ ip6addrctl \ ipfilter \ ipfs \ ipfw \ ipmon \ ipnat \ ipsec \ ${_ipxrouted} \ ${_kadmind} \ ${_kdc} \ ${_kfd} \ kld \ kldxref \ ${_kpasswdd} \ ldconfig \ local \ localpkg \ lockd \ mixer \ motd \ mountcritlocal \ mountcritremote \ mountlate \ mdconfig \ mdconfig2 \ mountd \ mroute6d \ mrouted \ msgs \ natd \ netif \ netoptions \ netwait \ newsyslog \ nfsclient \ nfscbd \ nfsd \ nfsuserd \ nisdomain \ ${_nscd} \ nsswitch \ ntpdate \ ${_opensm} \ pf \ pflog \ pfsync \ postrandom \ ppp \ pppoed \ pwcheck \ quota \ random \ rarpd \ rctl \ resolv \ rfcomm_pppd_server \ root \ route6d \ routing \ rpcbind \ rtadvd \ rtsold \ savecore \ sdpd \ securelevel \ serial \ sppp \ ${_sshd} \ statd \ static_arp \ static_ndp \ stf \ swap \ swaplate \ sysctl \ syslogd \ tmp \ ${_ubthidhci} \ ugidfw \ ${_unbound} \ ${_utx} \ var \ virecover \ watchdogd \ ypbind \ yppasswdd \ ypserv \ ypset \ ypupdated \ ypxfrd \ zfs \ zvol .if ${MK_ACCT} != "no" FILES+= accounting .endif .if ${MK_ACPI} != "no" FILES+= power_profile .endif .if ${MK_ACPI} != "no" || ${MK_APM} != "no" FILES+= powerd .endif .if ${MK_AMD} != "no" FILES+= amd .endif .if ${MK_APM} != "no" FILES+= apm FILES+= apmd .endif .if ${MK_AUTOFS} != "no" FILES+= automount FILES+= automountd FILES+= autounmountd .endif .if ${MK_BLUETOOTH} != "no" _bluetooth= bluetooth _bthidd= bthidd _hcsecd= hcsecd _ubthidhci= ubthidhci .endif .if ${MK_BOOTPARAMD} != "no" FILES+= bootparams .endif .if ${MK_BSNMP} != "no" FILES+= bsnmpd .endif .if ${MK_CCD} != "no" FILES+= ccd .endif .if ${MK_FTP} != "no" FILES+= ftpd .endif .if ${MK_HAST} != "no" FILES+= hastd .endif .if ${MK_IPX} != "no" _ipxrouted= ipxrouted .endif .if ${MK_INETD} != "no" FILES+= inetd .endif .if ${MK_ISCSI} != "no" FILES+= iscsictl FILES+= iscsid .endif .if ${MK_JAIL} != "no" FILES+= jail .endif .if ${MK_KERBEROS} != "no" FILES+= ipropd_master FILES+= ipropd_slave _kadmind= kadmind _kdc= kdc _kfd= kfd _kpasswdd= kpasswdd .endif .if ${MK_LEGACY_CONSOLE} != "no" FILES+= moused FILES+= syscons .endif .if ${MK_LPR} != "no" FILES+= lpd .endif .if ${MK_MAIL} != "no" FILES+= othermta .endif .if ${MK_NS_CACHING} != "no" _nscd= nscd .endif .if ${MK_NTP} != "no" FILES+= ntpd .endif .if ${MK_OFED} != "no" _opensm= opensm .endif .if ${MK_OPENSSL} != "no" FILES+= keyserv .endif .if ${MK_OPENSSH} != "no" _sshd= sshd .endif .if ${MK_PF} != "no" FILES+= ftp-proxy .endif .if ${MK_RCMDS} != "no" FILES+= rwho .endif .if ${MK_ROUTED} != "no" FILES+= routed .endif .if ${MK_SENDMAIL} != "no" FILES+= sendmail .endif .if ${MK_TIMED} != "no" FILES+= timed .endif .if ${MK_UNBOUND} != "no" _unbound= local_unbound .endif .if ${MK_UTMPX} != "no" _utx= utx .endif .if ${MK_WIRELESS} != "no" FILES+= hostapd FILES+= wpa_supplicant .endif FILESDIR= /etc/rc.d FILESMODE= ${BINMODE} .include Index: stable/10/etc/rc.d/growfs =================================================================== --- stable/10/etc/rc.d/growfs (nonexistent) +++ stable/10/etc/rc.d/growfs (revision 284009) @@ -0,0 +1,96 @@ +#!/bin/sh +# +# Copyright 2014 John-Mark Gurney +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# PROVIDE: growfs +# BEFORE: sysctl +# KEYWORD: firstboot + +# This allows us to distribute a image +# and have it work on essentially any size drive. +# +# TODO: Figure out where this should really be ordered. +# I suspect it should go just after fsck but before mountcritlocal. +# + +. /etc/rc.subr + +name="growfs" +start_cmd="growfs_start" +stop_cmd=":" +rcvar="growfs_enable" + +growfs_start () +{ + echo "Growing root partition to fill device" + rootdev=$(df / | tail -n 1 | awk '{ sub("/dev/", "", $1); print $1 }') + if [ x"$rootdev" = x"${rootdev%/*}" ]; then + # raw device + rawdev="$rootdev" + else + rawdev=$(glabel status | awk '$1 == "'"$rootdev"'" { print $3 }') + if [ x"$rawdev" = x"" ]; then + echo "Can't figure out device for: $rootdev" + return + fi + fi + + sysctl -b kern.geom.conftxt | awk ' +{ + lvl=$1 + device[lvl] = $3 + type[lvl] = $2 + idx[lvl] = $7 + parttype[lvl] = $13 + if (dev == $3) { + for (i = 1; i <= lvl; i++) { + # resize + if (type[i] == "PART") { + pdev = device[i - 1] + cmd[i] = "gpart resize -i " idx[i] " " pdev + if (parttype[i] == "GPT") + cmd[i] = "gpart recover " pdev " ; " cmd[i] + } else if (type[i] == "LABEL") { + continue + } else { + print "unhandled type: " type[i] + exit 1 + } + } + for (i = 1; i <= lvl; i++) { + if (cmd[i]) + system(cmd[i]) + } + exit 0 + } +}' dev="$rawdev" + growfs -y /dev/"$rootdev" +} + +load_rc_config $name +run_rc_command "$1" Property changes on: stable/10/etc/rc.d/growfs ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/10/share/man/man7/Makefile =================================================================== --- stable/10/share/man/man7/Makefile (revision 284008) +++ stable/10/share/man/man7/Makefile (revision 284009) @@ -1,51 +1,52 @@ # @(#)Makefile 8.1 (Berkeley) 6/5/93 # $FreeBSD$ .include #MISSING: eqnchar.7 ms.7 term.7 MAN= adding_user.7 \ ascii.7 \ bsd.snmpmod.mk.7 \ build.7 \ clocks.7 \ c99.7 \ development.7 \ environ.7 \ ffs.7 \ firewall.7 \ + growfs.7 \ hier.7 \ hostname.7 \ intro.7 \ maclabel.7 \ mailaddr.7 \ operator.7 \ ports.7 \ release.7 \ sdoc.7 \ security.7 \ sprog.7 \ stdint.7 \ sticky.7 \ tests.7 \ tuning.7 MLINKS= intro.7 miscellaneous.7 MLINKS+= security.7 securelevel.7 MLINKS+= c99.7 c.7 MLINKS+= c99.7 c78.7 MLINKS+= c99.7 c89.7 MLINKS+= c99.7 c90.7 .if ${MK_TESTS} != "no" ATF= ${.CURDIR}/../../../contrib/atf .PATH: ${ATF}/doc MAN+= atf.7 CLEANFILES+= atf.7 atf.7: atf.7.in sed -e 's,__DOCDIR__,/usr/share/doc/atf,g' \ <"${ATF}/doc/atf.7.in" >atf.7 .endif .include Index: stable/10/share/man/man7/growfs.7 =================================================================== --- stable/10/share/man/man7/growfs.7 (nonexistent) +++ stable/10/share/man/man7/growfs.7 (revision 284009) @@ -0,0 +1,64 @@ +.\" Copyright 2014 John-Mark Gurney +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 1, 2014 +.Dt GROWFS 7 +.Os +.Sh NAME +.Nm growfs +.Nd start up script to grow the root file-system. +.Sh DESCRIPTION +The following options in +.Pa /etc/rc.conf +control the behavior of +.Nm : +.Bl -tag -width ".Va growfs_enable" -offset indent +.It Va growfs_enable +.Pq Dq Li NO +If set to +.Dq Li YES , +the first time the machine boots, the root file-system will be automatically +expanded, if possible, to fill up all available space after it. +.El +.Pp +To expand the root file-system with-out rebooting, run the following command: +.Dl % /etc/rc.d/growfs onestart +.Sh IMPLEMENTATION NOTES +The script requires that +.Pa awk +be present and on the path. +This usually means that +.Pa /usr +should be mounted prior to running the script. +.Sh FILES +.Pa /etc/rc.conf +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr rc.conf 5 +.Sh AUTHORS +The man page and script were written by +.An John-Mark Gurney Aq Mt jmg@FreeBSD.org . Property changes on: stable/10/share/man/man7/growfs.7 ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: stable/10 =================================================================== --- stable/10 (revision 284008) +++ stable/10 (revision 284009) Property changes on: stable/10 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r273955,274060,274164