Since changing my HomeAssistant installation from the RaspberryPi to a bhyve vm running on FreeBSD things have been going well. The vm works well and everything just works. Over time I've added more sensors and automations which has increased it's usefulness.

Of course with more sensors you get more data. Add in the system snapshots for the regular updates and the original 32G disk image starts to fill.

I started seeing warnings from the system a few weeks ago. Removing some very old snapshots resolved things temporarily but a longer term solution was needed.

Disk Image

bhyve uses a simple disk image to contain it's entire vm. You need to know the name of the vm before you can get more information.

$ sudo vm list
home_assistant  default    uefi    4    4G      -    Yes [1]    Running

To get more detailed information about the vm, use the info command.

$ sudo vm info home_assistant
Virtual Machine: home_assistant
  state: running (87241)
    number: 0
    device-type: file
    emulation: ahci-hd
    options: -
    system-path: <vm disk>/home_assistant/disk0.img
    bytes-size: 34359738368 (32.000G)
    bytes-used: 68764566528 (64.041G)

Before doing anything else, we need to stop the vm.

$ sudo vm stop home_assistant

Growing The Image

The biggest question was how to grow the image. I couldn't find anything that addressed this specifically online but it turned out to be simpler than I thought it would.

The first step was to create a larger , empty disk image. As this will eventually be used for the vm it's easiest to create it in the same place as the current image.

$ cd <vm disk>/home_assistant
$ sudo truncate -s 100G newha.img

Next, copy the current image into the newly created file.

$ sudo dd if=disk0.img of=newha.img conv=notrunc

After waiting for the copy to complete, we simply swap the files.

$ sudo mv disk0.img original.img
$ sudo mv newha.img disk0.img

As the disk image is fully self contained I wasn't sure if it would be happy having been copied, but as it turns out bhyve is smart enough to figure this out and expand to use the available space.

$ sudo vm start home_assistant
Starting home_assistant
  * found guest in /eric/vm/home_assistant
  * booting...

After taking a few moments to start and settle the system was fully available and showing disk usage around the 30% mark.