freebsd-dev/libexec
Mike Karels 4a30d7bb37 growfs script: add swap partition as well as growing root
Add the ability to create a swap partition in the course of growing
the root file system on first boot, enabling by default.  The default
rules are: add swap if the disk is at least 15 GB (decimal), and the
existing root is less than 40% of the disk.  The default size is 10%
of the disk, but is limited by the memory size.  The limit is twice
memory size up to 4 GB, 8 GB up to 8 GB memory, and memory size over
8 GB memory. Swap size is clamped at vm.swap_maxpages/2 as well.
The new swap partition is labeled as "growfs_swap".

The default behavior can be overridden by setting growfs_swap_size in
/etc/rc.conf or in the kernel environment, with kenv taking priority.
A value of 0 inhibits the addition of swap, an empty value specifies
the default, and other values indicate a swap size in bytes.

By default, addition of swap is inhibited if a swap partition is found
in the output of the sysctl kern.geom.conftxt before the current root
partition, usually meaning that there is another disk present.
Swap space is not added if one is already present in /etc/fstab.

The root partition is read-only when growfs runs, so /etc/fstab can
not be modified.  That step is handled by a new growfs_fstab script,
added in a separate commit.  Set the value "growfs_swap_pdev" in kenv
to indicate that this should be done, as well as for internal use.

There is optional verbose output meant for debugging; it can only be
enabled by modifying the script (in two places, for sh and awk).
This should be removed before release, after testing on -current.

Discussed with:	cperciva
Reviewed by:	imp (previous version)
Differential Revision:	https://reviews.freebsd.org/D37462
2022-12-10 13:38:36 -06:00
..
atf Explicitly set CXXSTD to c++11 for old C++ code using std::auto_ptr<>. 2022-12-04 16:25:21 -08:00
atrun libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
blacklistd-helper
bootpd bootptest: Fix a typo in a source code comment 2022-09-15 10:28:52 +02:00
comsat General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
dma dma(8): add newaliases to mailer.conf 2022-12-06 08:31:23 +01:00
fingerd Update Makefile.depend files 2019-12-11 17:37:53 +00:00
flua flua: chown(2) binding, fix bad copy/paste 2022-11-25 09:05:40 +01:00
ftpd Put OPIE to rest. 2022-10-02 03:37:29 +02:00
getty getty: Avoid NULL deref if stdin is not a tty. 2022-11-04 15:54:01 +01:00
hyperv pkgbase: Create a FreeBSD-hyperv package 2021-09-07 10:24:54 +02:00
mail.local
makewhatis.local makewhatis: do not try to operate on read-only mounted directories 2018-10-27 17:15:58 +00:00
mknetid General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
phttpget phttpget: move out of portsnap 2020-09-09 00:39:47 +00:00
pppoed libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
rbootd Fix the following -Werror warning from clang 10.0.0 in rbootd: 2020-01-28 19:19:55 +00:00
rc growfs script: add swap partition as well as growing root 2022-12-10 13:38:36 -06:00
revnetgroup General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rpc.rquotad pkgbase: Create a FreeBSD-nfs package 2021-06-19 17:49:50 +02:00
rpc.rstatd General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rpc.rusersd General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rpc.rwalld libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
rpc.sprayd rpc.sprayd: raise WARNS to 6 2018-03-05 16:11:07 +00:00
rtld-elf rtld: add support for the $LIB token 2022-11-11 12:06:30 +02:00
rtld-elf32 libcompat: Correct rtld MLINKS 2019-11-12 22:31:59 +00:00
save-entropy Reduce disk write load in /usr/libexec/save-entropy. 2019-11-30 20:06:53 +00:00
smrsh
talkd Regularize my copyright notice 2019-12-04 16:56:11 +00:00
tcpd pkgbase: Create a FreeBSD-tcpd package 2021-12-21 10:17:31 +01:00
tests
tftp-proxy (t)ftp-proxy: use libpfctl 2021-04-10 11:16:02 +02:00
tftpd tftpd: Disable -Wformat-nonliteral for GCC. 2022-11-22 11:12:06 -08:00
ulog-helper libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
ypxfr pkgbase: Put yellow pages programs to its own package 2021-12-21 10:17:22 +01:00
Makefile Remove telnetd 2022-09-28 19:53:49 +01:00
Makefile.amd64
Makefile.i386
Makefile.inc Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00