So I've looked around the net searching for how to do this. First, I'm quite disappointed that VirtualBox itself doesn't accompany a tool that does that. Secondly, most of the solutions I found were complex or involved downloading large LiveCD images. Until I found this blog, which not only compiles many links to other solutions, but provides a simple one -- the one I used and recommend.
If you're brave enough (you must be; We are dealing with disk partitions here) all you have to do is:
- Download GParted LiveCD (~150MB) from here.
- Define a new HDD in VirtualBox and set it to be your secondary partition.
- Mount the live cd as the primary IDE controller. Make sure the BIOS in your Virtual Machine is configured to boot from the CD first (and HDD next).
- Boot GParted in command line (shell) mode.
- Use fdisk -l to identify the old disk and the new one. Be careful!
- Usually, your original partition will be /dev/hda*, where * is a number. It can also be /dev/sda*. The new partition can have another number (higher one, in most cases) or be something like /dev/sdb.
- Remember that GParted will have a partition of its on, mounted on /. Use mount to list mounted partitions.
- If you try to mount a unpartitioned hdd mount will tell that you need to inform its file format. That is a good clue you are talking about the right partition.
- Once you identified the source and target devices, all you have to do is dd if=[source] of=[target]. It will take a long time, since its doing a byte-by-byte copy of your partition.
- Assuming your source device is /dev/hda2 and your target is /dev/hdb, the command above should be: dd if=/dev/hda2 of=/dev/hdb
Once the copy is over, all you need to do is shutdown the system, map only the new drive as the main HDD of your VM, and boot it up.