I installed Windows 7 on Virtual Box but didn’t estimate the disk size correctly. The drive is now nearing it’s capacity and the below is what I did to extend my VDI disk Space
- Create a new virtual disk
- Clone the old disk to this newly created virtual disk
- Re-preference the old disk via storage settings in Virtual Box
- Boot up using the new disk
- Useing diskpart to extend the volume
Create a new virtual disk
Create new virtual disk via Settings –> Storage. Choose the + sign nest to the HDD Disk icon.
Select the appropriate size as per your requirement.
Choose Dynamically expanding storage for the disk storage type.
Clone the old disk to this newly created virtual disk
This step will clone the data on the old disk on to the new disk.
Use the following command to accomplish assuming that you have Virtual Box installed configured in its default location.
C:Program FilesOracleVirtualBox>VBoxManage.exe clonehd “c:UsersayussufVirtualBox VMsWin7 PersonalWin7 Personal-disk1.vdi” “C:UsersayussufVirtualBox VMsWin7 PersonalWin 7 Personal-Disk50.vdi” –existing
The blue section is the actual command
The red section is the location of the full disk
The Green section is the location of the new disk
It does take some time… depending on how fast your computer is but wait until it saus 100%.
Clone hard disk created in format ‘VDI’. UUID: 8865cafa-59f2-4b3e-ae3a-8d88423e215a
Re-preference the old disk via storage settings in Virtual Box
There are two ways in getting this done.
- Remove the old drive which is basically removing the drive from Virtual Box
- Re-preference drives so the new drive will become the primary and the old drive can be deleted at a later date.
To re-preference the old drive, click on the old drive and assign it a high port number and the new disk the lowest (Port 0)
Boot up the machine… it will use the new disk.
Useing “diskpart” to extend the volume
Even though you are using the new Disk, your computer will continue to recognize it as the old size. This can be verified using Computer Disk Management which can also be used to extend the partition.
In a command prompt, type diskpart… a new window should appear.
Enter select vol c – if your volume name is C
Your completion message should read: DiskPart successfully extended the volume
Have fun with the extended size and don’t worry about fillings it up.