VirtualBox is one of the most useful virtualization software available for free.
Creating virtual machine is easy, just a few clicks and we are able to explore new operating system. What we need to sacrifice is some processor time, RAM memory and a few GBof hard drive. These resources can be dynamically allocated, even the hard drive.
Recently, I had set up a developement environment on a virtual machine running Windows 7. Hard disk has been dynamically allocated at 30 GB. I was running GlassFish server with MySQL database and Eclipse IDE. I also had installed ruby with rails framework along and Aptana Studio. As you can imagine VHD become insufficient. As I couldn’t afford to install everything from scratch again, I decided to extend virtual disk.
Well, extending a VDI disk is impossible, but every problem has also a solution. Following steps bellow, I was able to “extend” my virtual image:
- First you have to prepare an USB drive with at least as free space as your virtual disk image size is.
You can also create a virtual disk from partition on physical disk following this instructions:
- Add USB disk or mapped partition to virtual machine.
- Find disk cloning software.
I used Clonezilla.
- Run virtual machine from bootable ISO image.
Clonezilla comes as live CD. What you need is actually an ISO image. Make sure that your USB drive or mapped partition is accessible at start.
- Follow Clonezilla wizard to clone virtual disk to local USB or mapped partition.
- Create a new virtual disk with desired size (about 100 GB dynamically allocated).
- Add disk to virtual machine and remove old virtual disk.
- On newly created disk write partitions table.
- Run virtual machine with Clonezilla CD again.
Make sure you have also included USB drive or mapped partition.
- Follow Clonezilla wizard to restore image to virtual disk from local USB or mapped partition.
- At last you have to resize partition inside OS.
In my case Windows.
For any further questions or step explanation don’t hesitate to comment.
- Virtual Disks Make Data Recovery Accessible (prweb.com)
- Clonezilla live clone system brings enhancements (h-online.com)
- in qemu/kvm, can I mount a host partition as a virtual disk drive? (stackoverflow.com)