In order to expand a hard disk in virtualbox (e.g. a windows 7 partition, in our example is called x7pro.vdi 12GB) one has to follow these steps:

  1. Create a new larger disk from Virtual Media Manager [VirtualBox File -> Virtual Media Manager]: e.g. w7.vdi, 70GB

    Screenshot-Virtual Media Manager
  2. Download a stable version (the .iso file) of System Rescue CD.
  3. Change the settings of the currently active machine and add the newly created drive as secondary,

    Screenshot-w7pro - Settings
  4. add the System Rescue CD iso file as it’s CD,

    Screenshot-w7pro - Settings-1
  5. boot the virtual machine from the CD and start X windows ( at command prompt)
  6. It the Terminal type to start Gnome Partition Editor, Screenshot-w7pro [Running] - Sun VirtualBox
  7. When in Gnome Partition Editor select the device that contains the old operating system (in our example is: sda),

    Screenshot-w7pro [Running] - Sun VirtualBox
  8. Select the primary (boot) windows 7 partition (x7pro) and then select copy [if you do not have a separate boot partition then just copy the one with windows 7],

    Screenshot-w7pro [Running] - Sun VirtualBox-1
  9. Select the second (new) hard disk and paste,

    Screenshot-w7pro [Running] - Sun VirtualBox
  10. Accept default values when prompted for partition size etc.,
  11. Do the same for any other partitions that you might have,

    Screenshot-w7pro [Running] - Sun VirtualBox

  12. Click apply and then wait till it finishes up. This might take ages if your old partition is large.

    Screenshot-w7pro [Running] - Sun VirtualBox-1
  13. When done then select the primary partition: Manage Flags and select Boot for the newly created primary partition.

    Screenshot-w7pro [Running] - Sun VirtualBox
    Screenshot-w7pro [Running] - Sun VirtualBox-1
  14. Close gparted and power down the machine (Terminal -> )
  15. Change the settings of you Virtual machine to boot from the new HD, remove the System Resque CD from the CDrom list,
  16. Boot your virtual machine and you should have a larger HD.

.