These are the steps taken to reproduce the error (host is Windows 10):
How can I fix this? And how to do it properly next time?
- Open Oracle Virtualbox and create a new virtual machine, FreeBSD 64 bits. Choose to add virtual drive later.
- Download prebuilt image disk "FreeBSD-13.0-RELEASE-amd64.vhd".
- Attach the disk to the virtual machine.
- Start the guest FreeBSD and do configuration (update, create user, etc.)
- Power off the virtual machine
- On Virtualbox, go to File --> Virtual Media Manager... --> select "FreeBSD-13.0-RELEASE-amd64.vhd" --> change size to bigger value. I did it twice, first to 10GB and later to 16GB --> Apply
- Start again the virtual machine, and check that GPT partition is corrupt. It detects the proper size of the whole drive, but not the free space.


How can I fix this? And how to do it properly next time?