====== Resizing opnSense virtual ====== Steps are mostly as follows - shutdown the vm & snapshot or back up image - resize the disk image. NOTE: must be larger to retain contents. Use one of the following, depending on where the disk image is stored - truncate -s 10G target.img # local image as a file - lvextend -L 10G /dev/vgname/lvname # an LVM volume - zfs set quota=10G storage/target # a ZFS volume - boot up resized opnsense - Find gpart show #Show all to select the correct target drive gpart show vtbd0 #Will likely show a corrupted GPT .... gpart recover vtbd0 #Repair the "corrupted" GPT gpart show vtbd0 #Show again to verify and find the partition we're interested in - This will show something similar to the following=> 40 20971440 vtbd0 GPT (10G) 40 532480 1 efi (260M) 532520 1024 2 freebsd-boot (512K) 533544 20437936 3 freebsd-ufs (9.7G) - Now, resize the partitiongpart resize -i 3 vtdb0 #Resize the freebsd-ufs partition (free space MUST be below the partition) gpart show vtbd0 #Verify resize is what we expect growfs /dev/gpt/rootfs #Grow the filesystem fsck -y /dev/gpt/rootfs #Force a filesystem check/repair - df should now show expanded file space -- reboot for good measure * https://unixcop.com/how-to-resize-and-growing-disks-in-freebsd/