FreeBSD guest online disk resize

From: Alexandre Biancalana <biancalana_at_gmail.com>
Date: Mon, 17 Nov 2025 19:01:05 UTC
Hello,

I am using bhyve with several VMs where the VM disks (NVMe) are stored
on an NFS server and exported to the hypervisor. Occasionally, I need
to expand the disks due to space constraints. I perform this expansion
by resizing the VM disk files using the truncate command.

On Linux guests, the disk resize is immediately recognized, and the
filesystem can be expanded online without issues.

However, on FreeBSD guests, while the NVMe layer recognizes the disk
resize (confirmed by the appearance of the asynchronous event message
in dmesg):

nvme2: async event occurred (type 0x2, info 0x00, page 0x04)

and `nvmecontrol devlist` correctly shows the new disk size, there is a problem.

The VM disk has no partition table and is formatted entirely with UFS
and has a ufs label, hence geom_label is in use. Unfortunately, glabel
list does not recognize the disk resize and still shows the old disk
size.

I have tried the following attempts to force recognition of the new
size without success:

Setting `sysctl kern.geom.debugflags=16`

Resetting the NVMe controller with `nvmecontrol reset nvme2`

Rescanning the disk with `camcontrol rescan nda2` and `camcontrol reprobe nda2`

Ideally, I would like to perform a disk resize that FreeBSD recognizes
without requiring a system reboot.

Am I missing a step, or is there a recommended procedure to make
geom_label recognize the resized disk size dynamically on FreeBSD
guests?