Since most of what I found on the web was either wrong or more complicated than needed, here is what worked for me. (My drive image file was old.vdi and I wanted a new copy of that disk, new.vdi, which was 24 gigabytes (give or take).
- cd ~/.VirtualBox/HardDisks
- vboxmanage createhd –filename new.vdi –size 24000
- vboxmanage clonehd old.vdi new.vdi –existing
- Open VirtualBox, select the virtual machine, and click on Hard Disks.
- In the Attachments section, click on the existing image file name (old.vdi) and click the Select Hard Disk button to its right. This will open the Virtual Media Manager dialog.
- Select the old image file and click Release. Remove the old image file (old.vdi).
- Click Add and browse to the new image file (new.vdi). It will now appear in the Hard Disks list.
- Click the Select button at the bottom of the Virtual Media Manager dialog.
- Go download a gparted LiveCD .iso file. Click on the virtual machine’s CD/DVD-ROM settings. Make sure “Mount CD/DVD Drive” is checked, pick “ISO Image File”, and browse to the gparted ISO file you just downloaded.
- Click the OK button at the bottom of the Settings dialog to close it.
- Start up your virtual machine. Click in the window and press F12 to bring up the boot devices menu. Pick “c” for CD/DVD-ROM.
- Run gparted, click on your partition, and resize it to occupy the whole disk.
- Shut down gparted, reboot, and wait for Windows to check your new hard disk.
- Celebrate!
