re-size the BSD partition
On console mode or through ssh, start a Shell (example is only 4GB install with 4GB free disk):
[admin]:gpart show
=> 63 16777153 ad0 MBR (8.0G)
63 8388513 1 freebsd [active] (4G)
8388576 8388640 - free - (4.0G)
=> 0 8388513 ad0s1 BSD (4G)
0 16 - free - (8.0k)
16 7339921 1 freebsd-ufs (3.5G)
7339937 1048576 2 freebsd-swap (512M)
(assuming your disk is seen as ad0)
[admin]:gpart resize -i 1 ad0
ad0s1 resized
Due to a bug in gpart regarding the old MBR partitioning schemes, we need to force a global size update, as the MBR is still having the old global size.
Get the freebsd real partition size (2nd column of the gpart show ad0 output):
[admin]:gpart show ad0
=> 63 16777153 ad0 MBR (8.0G)
63 16777152 1 freebsd [active] (8G)
16777215 1 - free - (512B)
Using bsdlabel to edit this value onto the zise of c: line:
[admin]:bsdlabel -e /dev/ad0s1
# /dev/ad0s1:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 15728640 16 4.2BSD 0 0 0
b: 1048496 15728656 swap
c: 8388513 0 unused 0 0 # "raw" part, don't edit
So edit it to match this number; in our example: 16777152 (editor is vi):
# /dev/ad0s1:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 15728640 16 4.2BSD 0 0 0
b: 1048496 15728656 swap
c: 16777152 0 unused 0 0 # "raw" part, don't edit`
The partitions have now been re-sized properly.
Growing pfSense root filesystem
As the default disk partioning is setting a swap at the end of the disk, we must first note down its size and remove it before growing the root filesystem:
(Just be sure it the 2nd filesystem of your ad0s1 - 3rd column value in gpart show output)
[admin]:gpart delete -i 2 ad0s1
Re-sizing our root partition to all, but the swap partition size (gpart -s option do accept only integer values, so 7.5G = 7680M):
[admin]:gpart resize -i 1 -s 7680M ad0s1
ad0s1a resized
[admin]:growfs /dev/ad0s1a
We strongly recommend you to make a backup before growing the Filesystem
Did you backup your data (Yes/No) ? Yes
new file systemsize is: 3932160 frags
Warning: 302144 sector(s) cannot be allocated.
growfs: 7532.5MB (15426496 sectors) block size 16384, fragment size 2048
using 41 cylinder groups of 183.72MB, 11758 blks, 23552 inodes.
super-block backups (for fsck -b #) at:
7525280, 7901536, 8277792, 8654048, 9030304, 9406560, 9782816, 10159072, 10535328, 10911584,
11287840, 11664096, 12040352, 12416608, 12792864, 13169120, 13545376, 13921632, 14297888,
14674144, 15050400
And re-creating the swap partition:
[admin]:gpart add -t freebsd-swap ad0s1
ad0s1b added
Done. Our partition table is now as follow and the root filesystem has been properly expanded to use its full partition:
[admin]:gpart show
=> 63 16777153 ad0 MBR (8.0G)
63 16777152 1 freebsd [active] (8G)
16777215 1 - free - (512B)
=> 0 16777152 ad0s1 BSD (8G)
0 16 - free - (8.0k)
16 15728640 1 freebsd-ufs (7.5G)
15728656 1048496 2 freebsd-swap (512M)