GROWFS(7)          FreeBSD Miscellaneous Information Manual          GROWFS(7)

NAME

     growfs, growfs_fstab - start up scripts to grow the root file system and
     add swap

DESCRIPTION

     The growfs 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,
     growfs 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 sysctl(8) value of
     vm.swap_maxpages divided by 2.  By default, no swap partition is created
     if an existing swap partition is found or is listed in /etc/fstab, or the
     disk is under 15 GB.  The growfs_fstab script adds any new swap partition
     to /etc/fstab after the root file system is made writable, and enables
     its use as a dump partition if the dumpdev variable from rc.conf(5) is
     set to AUTO.

     The following options in /etc/rc.conf control the behavior of growfs:

           growfs_enable     ("NO") If set to "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.

           growfs_swap_size  ("") If set to "0", the addition of a swap
                             partition is disabled.  An empty value ("")
                             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.

     A setting for growfs_swap_size can be set in the kernel environment, in
     which case it overrides the value from /etc/rc.conf.

     To expand the root file system without rebooting, run the following
     command:
           % /etc/rc.d/growfs onestart
     In addition, if a swap partition is added, run the command:
           % /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.

IMPLEMENTATION NOTES

     The growfs 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 awk(1) be present and in the path.  This usually means that
     /usr must be available prior to running the script.

FILES

     /etc/fstab
     /etc/rc.conf

EXIT STATUS

     The growfs utility exits 0 on success, and >0 if an error occurs.

SEE ALSO

     fstab(5), rc.conf(5), growfs(8), zpool(8)

HISTORY

     The growfs manual page first appeared in FreeBSD 10.1.  The ability to
     add a swap partition was added in FreeBSD 13.2.

AUTHORS

     The man page and script were written by John-Mark Gurney
     <jmg@FreeBSD.org>.  The ability to create a swap partition was added by
     Michael Karels <karels@FreeBSD.org>.

FreeBSD 15.1-STABLE-HBSD       November 22, 2022                     GROWFS(7)