Freebsd – Shrink FreeBSD root partition

freebsdpfsenseufs

I currently have a pfSense 2.3.2-RELEASE which was installed with too little RAM and, now I realized that the swap partition is too small (8GB) and I want to expand it. The problem is there's no free space to do that, so I need to shrink the UFS root partition so I can create a bigger swap.

Is there a safe way to do that, besides reinstalling the pfSense?

For FreeBSD servers, i usually use gpart + growfs, but obviously it's not entirely the case.

Best Answer

You can easily add the swap using plain file on the FS without resizing of existing FS. The whole procedure is explained in the chapter 11.12 of the FreeBSD handbook https://www.freebsd.org/doc/handbook/adding-swap-space.html