Just the refreshment (based on this thread and on https://unix.stackexchange.com/questions/117023/expanding-the-disk-size-on-pfsense-under-vmware-esxi). pfSense is a Proxmox VM, virtual hard drive is virtio0.
[root@gw-2 ~]# swapoff -a
swapoff: removing /dev/label/swap0 as swap device
[root@gw-2 ~]# df -h /
Filesystem Size Used Avail Capacity Mounted on
/dev/ufsid/59d3a17dccecce22 2.9G 2.5G 180M 93% /
[root@gw-2 ~]# gpart show
=> 63 8388545 vtbd0 MBR (4.0G)
63 8388513 1 freebsd [active] (4.0G)
8388576 32 - free - (16K)
=> 0 8388513 vtbd0s1 BSD (4.0G)
0 16 - free - (8.0K)
16 6291345 1 freebsd-ufs (3.0G)
6291361 2097152 2 freebsd-swap (1.0G)
After the virtual drive expansion (added 2G in the Proxmox interface):
[root@gw-2 ~]# gpart show
=> 63 12582849 vtbd0 MBR (6.0G)
63 8388513 1 freebsd [active] (4.0G)
8388576 4194336 - free - (2.0G)
=> 0 8388513 vtbd0s1 BSD (4.0G)
0 16 - free - (8.0K)
16 6291345 1 freebsd-ufs (3.0G)
6291361 2097152 2 freebsd-swap (1.0G)
[root@gw-2 ~]# gpart resize -i 1 vtbd0
vtbd0s1 resized
[root@gw-2 ~]# gpart show
=> 63 12582849 vtbd0 MBR (6.0G)
63 12582849 1 freebsd [active] (6.0G)
=> 0 12582849 vtbd0s1 BSD (6.0G)
0 16 - free - (8.0K)
16 6291345 1 freebsd-ufs (3.0G)
6291361 6291488 - free - (3.0G)
[root@gw-2 ~]# gpart resize -i 1 -s 5GB vtbd0s1
vtbd0s1a resized
[root@gw-2 ~]# gpart show
=> 63 12582849 vtbd0 MBR (6.0G)
63 12582849 1 freebsd [active] (6.0G)
=> 0 12582849 vtbd0s1 BSD (6.0G)
0 16 - free - (8.0K)
16 10485760 1 freebsd-ufs (5.0G)
10485776 2097073 - free - (1.0G)
[root@gw-2 ~]# growfs /dev/ufsid/59d3a17dccecce22
Device is mounted read-write; resizing will result in temporary write suspension for /.
It's strongly recommended to make a backup before growing the file system.
OK to grow filesystem on /dev/ufsid/59d3a17dccecce22, mounted on /, from 3.0GB to 5.0GB? [yes/no] yes
super-block backups (for fsck_ffs -b #) at:
6411392, 7693632, 8975872, 10258112
[root@gw-2 ~]# df -h /
Filesystem Size Used Avail Capacity Mounted on
/dev/ufsid/59d3a17dccecce22 4.8G 2.5G 1.9G 56% /
[root@gw-2 ~]# gpart add -t freebsd-swap vtbd0s1
vtbd0s1b added
[root@gw-2 ~]# /sbin/glabel label swap0 /dev/vtbd0s1b
[root@gw-2 ~]# swapon -a
swapon: adding /dev/label/swap0 as swap device