Skip to content

How to Resize a ZFS Disk on FreeBSD 14.3 in VMware

If you’re running FreeBSD in a VMware virtual machine, eventually you may run out of disk space. Luckily, FreeBSD with ZFS makes it straightforward to expand your storage once you’ve added more space to the virtual disk.

In this guide, I’ll walk through how I expanded my FreeBSD 14.3 ZFS root disk from 20 GB to 30 GB inside VMware, using real command output from my system.

Step 1. Add More Space to the VMware Disk

In VMware, edit your VM settings and increase the size of your primary disk. In my case, I expanded it from 20 GB → 30 GB.

After restarting the VM, FreeBSD can see the new size.

Step 2. Check Current Partitions

Run:

gpart show

Output before resizing:

=>      40  62914487  nda0  GPT  (30G)
        40    532480     1  efi  (260M)
    532520      2008        - free -  (1.0M)
    534528   4194304     2  freebsd-swap  (2.0G)
   4728832  37212160     3  freebsd-zfs  (18G)
  41940992  20973535        - free -  (10G)

Notice the 10G free space at the end of the disk (- free -). That’s the space we need to attach to our ZFS partition (nda0p3).

Step 3. Resize the Partition

Tell FreeBSD to grow the ZFS partition to fill the free space:

gpart resize -i 3 nda0

Output:

nda0p3 resized

Step 4. Expand the ZFS Pool

Now ZFS needs to be told to use the larger partition. Run:

zpool online -e zroot nda0p3

No output means it succeeded.

Step 5. Verify the Changes

Check available space with:

df -h

Output after resizing:

Filesystem                                 Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default                          15G    5.8G    9.7G    37%    /
...
zroot/usr/ports                             18G    8.1G    9.7G    46%    /usr/ports
zroot/usr/src                               11G    858M    9.7G     8%    /usr/src
...
zroot/iocage/jails/gitea/root               11G    1.8G    9.7G    16%    /zroot/iocage/jails/gitea/root

And check the ZFS pool size:

zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
zroot  27.5G  16.9G  10.6G        -         -    57%    61%  1.00x    ONLINE  -

The pool grew from 18G → 27.5G and now has ~10 GB of free space available.

Step 6. Enable Autoexpand (Optional)

To avoid running zpool online -e manually in the future, enable ZFS autoexpand:

zpool set autoexpand=on zroot

You can check the setting with:

zpool get autoexpand zroot

And that’s it — your ZFS pool grows without a reboot or downtime.

Published inFreeBSD