New
#1
How to resize a Virtual Hard Disk in VirtualBox
You can use the following link to resize your virtual hard disk:
Trivial Proof: Resizing a VirtualBox Virtual Hard Disk
Tips:
1. For a dynamic size virtual hard disk, you can just use the VBoxManage modifyhd --resize command, as explained in the link.
2. For a fixed size virtual hard disk, you must first clone the virtual hard disk, and then resize the clone, as explained in the link. When you clone a fixed disk, the clone is a dynamic sized disk by default.
Emphasize: You cannot just resize a FIXED size virtual disk.
2a. You can then replace the original virtual hard disk with the clone in the settings for the virtual machine in:
In the VirtualBox settings for the virtual machine (Settings --> Storage --> Controller for the .vdi file --> click the round disks button in the top right to choose which .vdi to boot from).
2b. You can then go to:
In the main VirtualBox window, File --> Virtual Media Manager, and delete the old .vdi file (Remove option).
Note: When you resize, the number you give to the command is in megabytes, so in my case I wanted to resize from 8 GB to 12 GB, so I used --resize 12288.
3. If the host is Windows, here are some tips:
- Use Windows Explorer to go to the folder that contains the .vdi file to work on.
- Hold down the shift key, right click, and choose Open Cammand Window Here.
- When using VBoxManage, all paths and file names that contain spaces must be enclosed in quotations.
- For example, in my case I had to use:
- "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd "Ubuntu 11.10 64 bit.vdi" "Ubuntu 11.10 64 bit clone.vdi" --existing
- The same applies for the VBoxManage modifyhd --resize command.
4. If you are cloning linux, and then resizing, and then using GParted afterward, as explained in the link, here are some tips:
- In my case, I had a swap partition. What I did was to delete the swap partition, resize my cloned partition (leaving enough space to add the swap back again afterwards), and then added a new swap partition at the end of the virtual hard drive. I found this the easiest way to do it.
5. For cloning, there's an option for it in the Virtual Media Manager (Copy option, I guess), but I didn't try it yet. That might be easier, as I've read online.
I hope these tips are helpful.