Resize drive and partition on FreeBSD 12 (pfSense)

Recently I described how to increase drive, partition and filesystem on FreeBSD in Azure virtual machine. It turned out that this scenario was little bit different from a virtual machine running on top of VMware. First of all, with or without vm-tools I was not able to get updated drive size:

Text
camcontrol rescan all

It gives messages that rescanning was successful, but actually it did not apply new values. However we can check new drive size with the following command:

Text
camcontrol readcap da0 -h    # daX

If on your system you get same results, then you need to reboot.

There is also a difference of having swap space. First disable it:

Bash
cat /etc/fstab               # pick swap device to use
swapoff /dev/label/swap0     # as an example

Then remove swap partition as freebsd-ufs partition need to be a continuous space:

Text
gpart delete -i 2 da0s1      # refer to gpart show

Then as previously run resizing commands:

Bash
gpart resize -i X da0        # X would be probably 1
service growfs onestart

Now you are done.

View as Markdown

All the content on this website is licensed under Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0). Cite as: Michał Sobczak, “Resize drive and partition on FreeBSD 12 (pfSense)”, 12 September 2022, https://michalasobczak.pl/posts/resize-drive-and-partition-on-freebsd-12-pfsense.html