FreeBSD disk/partition resize – grow on version 8.2 and newer under vmware vSphere / ESXi

This one is easier than previous (FreeBSD 7.x or older).

It may be possible to do it all live but you need to find a way for FreeBSD to see the growed disk size.

  • Shut down the server
  • Grow the disk size
  • Boot FreeBSD in single user mode (number 4 at boot)
Check the partitions layout:

gpart show

Set the system in evil mode that will allow gpart to change live filesystem:

sysctl kern.geom.debugflags=16

Grow the whole disk – consumer. Number 1 is the consumer index shown with gpart show

gpart resize -i 1 da0

Grow desired provider – partition. Number 6 is the provider index shown with gpart show

gpart resize -i 6 da0s1

Now with partition resized you can growfs

growfs /dev/da0s1f

Reboot for a clean feeling and you’re done.

S.