git: 22c4099b047f - main - EC2: Enable autogrowing filesystems post-boot

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Mon, 24 Aug 2026 05:08:10 UTC
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=22c4099b047f33d23266c7fbf545c7ae85f183ba

commit 22c4099b047f33d23266c7fbf545c7ae85f183ba
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-08-24 05:06:06 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-08-24 05:06:06 +0000

    EC2: Enable autogrowing filesystems post-boot
    
    Enable the new growfs_postboot mechanism.  Note that this also implies
    disabling automatic allocation of swap space on the root disk, since we
    cannot grow the root filesystem if swap space is allocated after it.
    
    This will not be MFCed since it is a significant behavioural change.
    
    Sponsored by:   Amazon
    Relnotes:       yes
---
 release/tools/ec2-base.conf  | 6 +++++-
 release/tools/ec2-small.conf | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/release/tools/ec2-base.conf b/release/tools/ec2-base.conf
index 24b2feb5f0d7..bbee8a961cae 100644
--- a/release/tools/ec2-base.conf
+++ b/release/tools/ec2-base.conf
@@ -16,7 +16,7 @@ export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} amazon-ssm-agent ec2-scripts \
 # Services to enable in rc.conf(5).
 export VM_RC_LIST="${VM_RC_LIST} ec2_configinit ec2_ephemeral_swap \
     ec2_fetchkey ec2_loghostkey firstboot_pkg_upgrade firstboot_pkgs \
-    growfs sshd"
+    growfs growfs_postboot sshd"
 
 vm_extra_pre_umount() {
 	# The AWS CLI tools are generally useful, and small enough that they
@@ -27,6 +27,10 @@ vm_extra_pre_umount() {
 	# Limit firstboot_pkg_upgrade to the base system.
 	echo 'firstboot_pkg_upgrade_repos="FreeBSD-base"' >> ${DESTDIR}/etc/rc.conf
 
+	# Don't allocate swap space when we first boot; that makes it
+	# impossible to grow the root filesystem later.
+	echo 'growfs_swap_size=0' >> ${DESTDIR}/etc/rc.conf
+
 	# Any EC2 ephemeral disks seen when the system first boots will
 	# be "new" disks; there is no "previous boot" when they might have
 	# been seen and used already.
diff --git a/release/tools/ec2-small.conf b/release/tools/ec2-small.conf
index 6da4444bc835..30992d70b24f 100644
--- a/release/tools/ec2-small.conf
+++ b/release/tools/ec2-small.conf
@@ -34,12 +34,16 @@ export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} ec2-scripts \
 # Services to enable in rc.conf(5).
 export VM_RC_LIST="${VM_RC_LIST} ec2_configinit ec2_ephemeral_swap \
     ec2_fetchkey ec2_loghostkey firstboot_pkg_upgrade \
-    growfs sshd"
+    growfs growfs_postboot sshd"
 
 vm_extra_pre_umount() {
 	# Limit firstboot_pkg_upgrade to the base system.
 	echo 'firstboot_pkg_upgrade_repos="FreeBSD-base"' >> ${DESTDIR}/etc/rc.conf
 
+	# Don't allocate swap space when we first boot; that makes it
+	# impossible to grow the root filesystem later.
+	echo 'growfs_swap_size=0' >> ${DESTDIR}/etc/rc.conf
+
 	# Any EC2 ephemeral disks seen when the system first boots will
 	# be "new" disks; there is no "previous boot" when they might have
 	# been seen and used already.