Page MenuHomeFreeBSD

rc+devd: Add growfs_postboot
ClosedPublic

Authored by cperciva on Sat, Aug 1, 12:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Aug 24, 4:54 PM
Unknown Object (File)
Fri, Aug 21, 8:53 PM
Unknown Object (File)
Thu, Aug 13, 10:48 AM
Unknown Object (File)
Thu, Aug 13, 2:05 AM
Unknown Object (File)
Wed, Aug 12, 3:29 PM
Unknown Object (File)
Tue, Aug 11, 8:49 AM
Unknown Object (File)
Tue, Aug 11, 4:30 AM
Unknown Object (File)
Mon, Aug 10, 8:38 AM
Subscribers

Details

Summary

In VM and cloud environments it is often possible to enlarge virtual
disks; this can be useful, for example, if a system is launched with a
small root disk and it later becomes clear that more space is needed.

On kernels which support run-time resizing of disks (for NVMe, this was
added in November 2025; some other disk types have supported this for
longer) a SIZECHANGE notification is sent to userland via devd.

Add a "nostart" rc.d script (runnable manually but not automatically at
boot time) and a devd script which invokes it when a notification
arrives. The rc.d script enlarges the "final partition" on partitioned
geoms, or the UFS filesystem or zpool device when triggered on a disk
containing either of those.

MFC after: 2 weeks
Relnotes: Disk partitions and filesystems can be enlarged

		automatically when disks grow by setting
		growfs_postboot_enable=YES in /etc/rc.conf.

Sponsored by: Amazon

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75975
Build 72858: arc lint + arc unit

Event Timeline

This is all I can find so far, but I didn't test it yet.

libexec/rc/rc.d/growfs_postboot
4–5

Please consider using this format for consistency with style guides and C style comments.

27
share/man/man7/growfs_postboot.7
2–25

Please consider using this format recommended by out style guides for consistency with C comments.

27

No change requested here, just note:

  1. both this and growfs(7) really shouldn't exist and should be part of rc.conf(5) for discoverability
  2. failing that, system operation commands do belong in section 8 per intro(8)
  3. failing that, we might as well match growfs(7) like the patch is currently doing... for now

Hopefully one day we can rewrite growfs(7), growfs_fstab(7), and this manual into a combination of rc.conf(5) and improved comments on the scripts themselves.

31
35
45

Macros inside list widths are cursed

85–86

Since you wrote everything, optionally consider using traditional style. Alternatively, it may make sense to append .An -nosplit after line 83 to change the line wrapping for when the AUTHORS section contains prose.

@ziaee Thanks for the corrections! In all of the cases of unstylishness you noted the only reason was that I wasn't sure what current style and I picked the wrong example to copy.

I reworded the description to

The
.Nm
script expands filesystems automatically.
Typically it is run via
.Xr devd 8
in response to a SIZECHANGE notification.
It will enlarge the final partition of a partitioned disk; expand a UFS
file system; or expand a zpool device, as appropriate.

since I wanted to make the distinction between what the script does and how it is normally invoked.

This revision is now accepted and ready to land.Sun, Aug 23, 1:20 AM

LGTM, thanks for inviting me!

This revision was automatically updated to reflect the committed changes.