mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
ba719a0fec
MFC after: 1 week Pull request: https://github.com/freebsd/freebsd-src/pull/853
141 lines
4.5 KiB
Groff
141 lines
4.5 KiB
Groff
.\" 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.
|
|
.\"
|
|
.Dd November 22, 2022
|
|
.Dt GROWFS 7
|
|
.Os
|
|
.Sh NAME
|
|
.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,
|
|
and the root file system is in the last partition,
|
|
.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 if the
|
|
.Va dumpdev
|
|
variable from
|
|
.Xr rc.conf 5
|
|
is set to
|
|
.Li AUTO .
|
|
.Pp
|
|
The following options in
|
|
.Pa /etc/rc.conf
|
|
control the behavior of
|
|
.Nm :
|
|
.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,
|
|
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
|
|
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
|
|
.Nm
|
|
script only attempts to expand the root file system,
|
|
and free space must be available immediately after the root partition.
|
|
It is normally used on images that have a single file system.
|
|
The script requires that
|
|
.Xr awk 1
|
|
be present and in the path.
|
|
This usually means that
|
|
.Pa /usr
|
|
must be available prior to running the script.
|
|
.Sh FILES
|
|
.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 ,
|
|
.Xr growfs 8 ,
|
|
.Xr zpool 8
|
|
.Sh HISTORY
|
|
The
|
|
.Nm
|
|
manual page first appeared in
|
|
.Fx 10.1 .
|
|
The ability to add a swap partition was added in
|
|
.Fx 13.2 .
|
|
.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 .
|