Recently, I had to do this as 10GB was not sufficient for Centos6.7 VM. I would just like to mention simple steps for how to do it.
How to Install New Apple Desktop operating system macOS Sierra on VirtualBox. Extract macOS Sierra Image File; Install VirtualBox on Your PC; Create a New Virtual Machine. I'm sure this is because I'm running Mac on VM and my apple serial at this point is '0'. Where you got.vdi file ( you selected Existing Vdi ).
Shutdown VM and quit from VirtualBox.
Open the terminal and go to the below path (default location). From here you can run the command to resize the VDI file.
Start another terminal with command + T and find the directory where actually the VDI file stored. Default location would be ,
Now from the location of step 2, run the command to resize it. I’m going to increase size from 10GB to 25GB
Here, I got the error because there is a space between VirtualBox and VMs so I have to use escape character to solve this,