From nobody Sat Dec 10 19:41:16 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NTytj2K9nz4kHpd; Sat, 10 Dec 2022 19:41:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NTytj0TbTz3kvM; Sat, 10 Dec 2022 19:41:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670701277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cfgl9G3JTFVH2/l4YsNj51jyRz7sbtaUjBYyU1zY4YY=; b=r3GkFWaiuWd/5yhc2Uuw4RO9AC2DFYiOfNdVtWYWbspvsxTMO3SFCIgumRA9ALhMVt8TVP j39ydPu7PQsB0EJqQV6NK+Rj8KFm2aqNxeQXKKOel5SWaEvc2R2TNliqg6TLusiwqWaLQs VCinNsFBvhlcwuHJ/c60kGsKm4GTtDld/KoDivpDv9d0EDn7e/abiNFyY1GbtpYPu11Dv8 zxhzqExYBV8yy6eCJu4qrN2iucmR4DFEllZUtH0NhsQ7WpXumeOuA048o1m610syImGUN0 bnCtRPTW/pFswIdOAfDcr1HtI9SvR24Yb63pNv+MygmFyMlXCWjpzAvYjC7yKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670701277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cfgl9G3JTFVH2/l4YsNj51jyRz7sbtaUjBYyU1zY4YY=; b=uF2bOspQMaZ7xGfns+SUSyW5PO14t0oHUn5pM+1rveGIsuqY519iPNLfTYSpp/kR8RuY8P 1ChLXQm/LpAQZbYhx6NfHmmxhEL5ktgBcwytghpm6NsibxpBkN5Kx0val1iCyO4CHghwTg UGvvaRtBLB19hfSfhBsQzbhv7+Vg7ZVD0O7z4GFsuZyeAzgXameToILiC2o0+iUor1YCq3 caewWoQ4ke8SFoWKj1IpQ6NfMKWttceTnJ7eE4zD7jL8LV/rTWKQT22q3NtdF4XTsnzQH5 JMaC1qIn7fdQZpDHjVa1qOBPZi2nSDt7uEmkZhZzeIVxtYu1R1opC7wnB+2Tow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1670701277; a=rsa-sha256; cv=none; b=Ff4T7HJjt7oQUoacO746i5teV205CPERmHjYRNmy6Sd/2zbpBPfHZmpsfILeLHiEuDKiQT X22n4zIF52qQlgSdF95/tXmbmu5pN29R9hXwEmzouWDmwmd3EQQT2wyRlmp0lYET/wUWWB fikOwAG8Q4PU8EGp0tFAkLFei6jBI0PdPhKvy6SDB1HkN9c+4Aa4SHPEhjWdaZcpxvTd5l HDI0lVrfcJHH0j1amPgKMHIb7kb4vy2pYfmrx216qq2/AsHBu6NYb5uBujkbQfWAQC8Gso sF+Q5E/CdIxr+dydnuAz2embogQuB45Lk2GT4uVgTp38Cb96IHpiXBxd/AKCUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NTyth6jWCzSD7; Sat, 10 Dec 2022 19:41:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BAJfGFH085318; Sat, 10 Dec 2022 19:41:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BAJfGvt085317; Sat, 10 Dec 2022 19:41:16 GMT (envelope-from git) Date: Sat, 10 Dec 2022 19:41:16 GMT Message-Id: <202212101941.2BAJfGvt085317@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mike Karels Subject: git: 4e240e55d818 - main - growfs(7): document addition of swap partition and growfs_fstab script List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e240e55d8186b44fe1bcda09b90ca7ffe65a58b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=4e240e55d8186b44fe1bcda09b90ca7ffe65a58b commit 4e240e55d8186b44fe1bcda09b90ca7ffe65a58b Author: Mike Karels AuthorDate: 2022-12-10 19:40:55 +0000 Commit: Mike Karels CommitDate: 2022-12-10 19:40:55 +0000 growfs(7): document addition of swap partition and growfs_fstab script Add documentation of the growfs script's new ability to add a swap partition, expanding on the previous functionality as well. Add the growfs_fstab helper script, which runs separately. Add a description of how to expand a file system a second time if swap had been added. While here, fix a typo. Reviewed by: pauamma Differential Revision: https://reviews.freebsd.org/D37465 --- share/man/man7/Makefile | 1 + share/man/man7/growfs.7 | 82 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 72 insertions(+), 11 deletions(-) diff --git a/share/man/man7/Makefile b/share/man/man7/Makefile index 228c4ea393d5..51061d13b4a8 100644 --- a/share/man/man7/Makefile +++ b/share/man/man7/Makefile @@ -34,6 +34,7 @@ MAN= arch.7 \ tuning.7 MLINKS= intro.7 miscellaneous.7 +MLINKS+= growfs.7 growfs_fstab.7 MLINKS+= security.7 securelevel.7 MLINKS+= c.7 c78.7 MLINKS+= c.7 c89.7 diff --git a/share/man/man7/growfs.7 b/share/man/man7/growfs.7 index 2e04e00f6abf..0ebc5b6f3ee0 100644 --- a/share/man/man7/growfs.7 +++ b/share/man/man7/growfs.7 @@ -24,46 +24,106 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2020 +.Dd November 22, 2022 .Dt GROWFS 7 .Os .Sh NAME -.Nm growfs -.Nd start up script to grow the root file-system +.Nm growfs , +.Nm growfs_fstab +.Nd start up scripts to grow the root file system and add swap .Sh DESCRIPTION +The +.Nm +script normally runs at the first boot after system installation. +If the boot disk is larger than the root file system and boot partitions, +.Nm +can expand the root file system. +It can also add a swap partition, with a default size of 10% of the boot disk. +Swap is limited to twice the memory size up to 4 GB, +8 GB up to 8 GB of memory, and memory size over 8 GB. +It is also limited to the +.Xr sysctl 8 +value of +.Li vm.swap_maxpages +divided by 2. +By default, no swap partition is created if an existing swap partition is found +or is listed in +.Pa /etc/fstab , +or the disk is under 15 GB. +The +.Nm growfs_fstab +script adds any new swap partition to +.Pa /etc/fstab +after the root file system is made writable, +and enables its use as a dump partition. +.Pp The following options in .Pa /etc/rc.conf control the behavior of .Nm : -.Bl -tag -width ".Va growfs_enable" -offset indent +.Bl -tag -width ".Va growfs_swap_size" -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. +the first time the machine boots, the root file system will be automatically +expanded, if possible, to fill up all available space after it, +after optionally adding a swap device at the end. +.It Va growfs_swap_size +.Pq Dq Li \& +If set to +.Dq Li 0 , +the addition of a swap partition is disabled. +An empty value +.Pq Dq Li \& +allows the creation of a swap partition with the default size. +If set to another value, +the swap partition will be created with the specified size in bytes, +even if another swap partition is detected. .El .Pp -To expand the root file-system with-out rebooting, run the following command: +A setting for +.Va growfs_swap_size +can be set in the kernel environment, in which case it overrides +the value from +.Pa /etc/rc.conf . +.Pp +To expand the root file system without rebooting, run the following command: .Dl % /etc/rc.d/growfs onestart +In addition, if a swap partition is added, run the command: +.Dl % /etc/rc.d/growfs_fstab onestart +Note that if a disk is expanded again, +and if the root file system had previously been expanded +and a swap partition added, it is necessary to delete the swap +partition before this procedure +in order to expand the root file system to the new size. +A new swap partition can be created during the expansion. .Sh IMPLEMENTATION NOTES The script requires that .Pa awk -be present and on the path. +be present and in the path. This usually means that .Pa /usr should be mounted prior to running the script. .Sh FILES -.Pa /etc/rc.conf +.Bl -tag -compact -width Pa +.It Pa /etc/fstab +.It Pa /etc/rc.conf +.El .Sh EXIT STATUS .Ex -std +.Sh SEE ALSO +.Xr fstab 5 , +.Xr rc.conf 5 .Sh HISTORY The .Nm manual page first appeared in .Fx 10.1 . -.Sh SEE ALSO -.Xr rc.conf 5 +The ability to add a swap partition was added in +.Fx 14.0 . .Sh AUTHORS The man page and script were written by .An John-Mark Gurney Aq Mt jmg@FreeBSD.org . +The ability to create a swap partition was added by +.An Michael Karels Aq Mt karels@FreeBSD.org .