From nobody Fri Jan 13 20:59:43 2023 X-Original-To: dev-commits-src-branches@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 4Ntv1W5M15z2pC5g; Fri, 13 Jan 2023 20:59:43 +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 4Ntv1W4w6yz3tKm; Fri, 13 Jan 2023 20:59:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673643583; 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=vyQvX6VBlWSCAADQKjA+vUjfcvdQNM6QhPIkF/5pDlk=; b=XKm84qtXeqhc1vRYK6xCO9yvKOIrXE7DT/a6yDd5xR1l8qumxwdFnVkzP01Yv4o09j3ddd EMlJ/T061z85c88K5QR7SiLboyMegmvMidXVN3c3A/kU3jHjLhQv1N4QvVA5dUJfq8eIsM Zxe8RSjrS3RQ0GGfLf6xuKo3FXlUw7LjbPBVfDRdIAQ8R4giBqxrPC1mw6H1Tcl33jMk60 d2DCAWmyyuX6JUccdSdiGdCxT1k2g0J0FLVZrzjHD7ypwBi2pgDRJ/m8LZ97n3YvTC2ETn czckQDOlONzUHAW0wLQBklBBwzHAOfGM1I8YEMbZGMN2K9yxOnoTtUBtLMZH5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673643583; 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=vyQvX6VBlWSCAADQKjA+vUjfcvdQNM6QhPIkF/5pDlk=; b=NhQTA0l6S8RJ3qUK7bMWDTqO6OetkqmmaiR+9l4iFj3q73HUwbHVQf0UHJbgq6LE6eiIvO 4H89KG3VPY8n+k4AQW414bnAjNsd5G6fiaioSg0q6nlovSdDyx7LVGYA7lGCSVcqS6HifZ J6uFZeIw1McDjFEfkLDxvICkLYPLqklR2XsToFCoqMQvyzJqN803lGbNmSEuZUIAOUcbp4 Y8xGHWPKtGpcy6Ho+YyljIBnImNNc58UuooRMz1E8nGZhwFVReDRhSOa/utKr+RQOjzg9K gB8l7E10wfOb53b7yyqrEn8EeW5FfzHIz3N/kg094WAzbftWDbj/zgKInBMaFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673643583; a=rsa-sha256; cv=none; b=QpKdSEHyOSwb0PxjBSfXvM48WZ57B9Qre67sGmAAxlidSuacdt28JKciZ9GTSl7VwTb/JY Yxcm9G74r4AUZ4qe2KPmeuKRVusT2VZJba7+Kkg1nNn7mf4HzZEkhqedvEY+AFJE/KeK5N YBDQysLLi5DdcURZnxeOcrciA+EQBgGrLqfvcHImR6F9XD006duNWZQkdAvVSJL0536sCQ V9HLGQHstnbK+XXnGXslQIPhv2eL3CpvHWBwubI8ljyNesTx+rC6kFwovPgBP9xWTvvY0c b8p/Bg6D/yZT6w1jRrG0XSUgih4KdIJU1YgEQ5eSsOyfvX8NXmhL97G85OGxLw== 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 4Ntv1W3SYvzMfV; Fri, 13 Jan 2023 20:59:43 +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 30DKxheW097133; Fri, 13 Jan 2023 20:59:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30DKxhwb097132; Fri, 13 Jan 2023 20:59:43 GMT (envelope-from git) Date: Fri, 13 Jan 2023 20:59:43 GMT Message-Id: <202301132059.30DKxhwb097132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: 0edf1fa0692e - stable/13 - growfs(7): document addition of swap partition and growfs_fstab script List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0edf1fa0692e565809794cf23c846b11bd6b5e54 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=0edf1fa0692e565809794cf23c846b11bd6b5e54 commit 0edf1fa0692e565809794cf23c846b11bd6b5e54 Author: Mike Karels AuthorDate: 2022-12-10 19:40:55 +0000 Commit: Mike Karels CommitDate: 2023-01-13 19:15:47 +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 (cherry picked from commit 4e240e55d8186b44fe1bcda09b90ca7ffe65a58b) --- 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 1ecd7363af1e..3ab247aae73c 100644 --- a/share/man/man7/Makefile +++ b/share/man/man7/Makefile @@ -35,6 +35,7 @@ MAN= arch.7 \ tuning.7 MLINKS= intro.7 miscellaneous.7 +MLINKS+= growfs.7 growfs_fstab.7 MLINKS+= security.7 securelevel.7 MLINKS+= c99.7 c.7 MLINKS+= c99.7 c78.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 .