How do I increase the hard disk size of the virtual machine?
Open a terminal and navigate to the folder with the VirtualBox disk image, then use the following command:
VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
replacing YOUR_HARD_DISK
and SIZE_IN_MB
with your image name and desired size. sudo
might be necessary in some machines or you might encounter an error. This answer and a fuller explanation are here, on webupd8. Credit to Andrew there for posting this answer.
After resizing, the extra virtual hard drive space needs to be partitioned and formatted for the guest to use it. This can be done with gparted by booting the guest from a live ISO. We can also resize the existing partition using gparted. For this we may need to disable /swap
and create a new swap partition.
In case if VBoxManage is not found in your system, just set the path to:
set PATH=%PATH%;"C:\Program Files\Oracle\VirtualBox"
and it should resolve path issue. Do make sure "VBoxManage" is present at this path before setting it.
Since VirtualBox 6 we can use a GUI for resizing VMs' virtual disks.
To access it, click File
-> Virtual Media Manager ...
The following window will open
Select your disk, and click Properties
. Now just move the slider at the bottom or write the value you want for the size and click "Apply" when you’re done.
After you start the virtual machine, Windows will not recognize the new space.
In Windows, open Computer Management
(search for it in the start menu), select Storage
-> Disk Management
in the left menu (In Windows 10 you can find it as create and format hard disk partitions
directly from the start menu). Select your partition (probably C:), right-click on it, and select Extend Volume ...
. Now just click through the wizard and you're done.
Note that on your VM Windows might not detect the extra space if you have snapshots in your VM. To fix this, it is recommended that you delete the snapshots or (the easiest way) just clone it and perform the resize in the new one.
The following worked for me:
VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
However, I understand how mileage can vary :-) As far as resizing the partition, in Windows 7, I was able to resize at the screen you showed by right clicking on the C: drive in the bottom panel and selecting extend volume.