Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
GROWFS(7)	   FreeBSD Miscellaneous Information Manual	     GROWFS(7)

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

     The growfs	script normally	runs at	the first boot after system installa-
     tion.  If the boot	disk is	larger than the	root file system and boot par-
     titions, 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 mem-
     ory 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	di-
     vided 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	ma-
			     chine boots, the root file	system will be auto-
			     matically 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	parti-
			     tion is disabled.	An empty value ("") allows the
			     creation of a swap	partition with the default
			     size.  If set to another value, the swap parti-
			     tion will be created with the specified size in
			     bytes, even if another swap partition is de-

     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 com-
	   % /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.

     The growfs	script only attempts to	expand the root	file system, and free
     space must	be available immediately after the root	partition.  It is nor-
     mally 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.


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

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

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

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

FreeBSD	13.0		       November	22, 2022		  FreeBSD 13.0


Want to link to this manual page? Use this URL:

home | help