- Turn off your guest OS
- Launch VirtualBox. Click on "Settings" for the virtual machine you want to change.
- Click on "Storage" on the left side.
- Click the icon that looks like a spindle of discs with a green plus sign next to "SATA Controller" (or whatever you use). "Add Hard Disk"
- Click the "Create New Disk" button
- Select "VDI (VirtualBox Disk Image" and click "Next"
- Click "Dynamically Allocated" and then click "Next"
- Select size and click "Create"
- Select the original virtual hard drive, and click "Remove Attachment"
- If you use IDE: Click the new virtual hard drive and select "IDE Primary Master"
- Click "OK"
- Run (this will take some time):
$ VBoxManage clonehd "full path to old virtual hard drive" "full path to new virtual hard drive" --existing
Boot your guest machine