When you create a virtual hard disk in VirtualBox or VMware, you specify a maximum disk size. Then if you want more hard disk space in your virtual machine, you need to enlarge the virtual hard disk and partition.
Note that you may want to back up your virtual hard disk file before performing these operations – there’s always a chance something could go wrong, so it’s always a good idea to have backups. However, the process worked well for us.
Update: Use Virtual Media Manager in VirtualBox
VirtualBox 6 has added a graphical option to enlarge and resize virtual disks. To access it, click File > Virtual Media Manager in the main VirtualBox window.
Select a virtual hard disk in the list and use the “Size” slider at the bottom of the window to change its size. Click Apply when done.
To use the extra space, you need to make the partition on the disk even bigger. The partition remains the same size even if the disk size increases. See instructions below for more information on resizing a partition.
Enlarge a virtual disk in VirtualBox using the command line
To enlarge a virtual disk in VirtualBox, you need to use the VBoxManage command from the command line window. First, shut down the virtual machine – make sure its status is set to “Off”, “Not Saved”.
Class: Before proceeding, you must delete any files scenes If you use VirtualBox’s Snapshots feature, the associated virtual machine. This will ensure that the correct virtual disk file has been converted and everything will work fine afterwards.
Second, open a command prompt window from the Start menu and change the directory to the VirtualBox program files folder. Run the command:
cd "C:\Program Files\Oracle\VirtualBox"
The following command will run on the VirtualBox virtual disk located at “C:\Users\Equinox\VirtualBox VMs\Windows 10\Windows 10.vdi”. The virtual disk size will be changed to 81,920 MB (80 GB).
VBoxManage modifyhd "C:\Users\Chris\VirtualBox VMs\Windows 10\Windows 7.vdi" --resize 81920
Class: I used two lines before Change the size In the above command.
Change the file path in the command above to the location of the VirtualBox disk you want to resize and the number you want to resize the image to (in megabytes).
Class: In VirtualBox 6.0+, released in 2019, you may need to use the following command instead:
VBoxManage modifymedium disk "C:\Users\Equinox\VirtualBox VMs\Windows 10\Windows 10.vdi" --resize 81920
Note that this process does not enlarge the partition on the virtual hard disk, so you still won’t be able to access the new space – see Enlarge a virtual machine partition below for more information.
Virtual Disk Expansion in VMware
To enlarge a virtual machine’s hard disk in VMware, power off the virtual machine, right-click on it, and select Virtual Machine Settings.
Select the virtual hard disk device in the list, click the Applications button, and then click Expand to expand the hard disk.
Enter the largest disk size and click the Expand button. VMware will increase the size of the virtual disk, although its partitions will remain the same size – see below for information about expanding a partition.
Maximize the virtual machine partition
You now have a large virtual hard disk. However, the OS partition on your virtual hard disk remains the same size, so you still cannot access that space.
Now you need to extend the guest OS partition just like you would extend a partition on a real hard disk. Just as the C:\ partition cannot be enlarged while Windows is running on your computer, the partition cannot be enlarged while the guest operating system is running.
You can use GParted Live CD to resize your virtual machine’s partition—if you run the GParted ISO image on your virtual machine, you’ll be taken to the GParted partition editor in a live Linux environment. GParted can resize a partition on a virtual hard disk.
Mount the ISO file to your virtual machine by going to the Virtual Machine Settings window, selecting the virtual CD drive, and browsing to the ISO file on your computer.
Boot (or reboot) your virtual machine after inserting the ISO image and the virtual machine will boot from the ISO image. GParted Live CD will ask you several questions during boot – you can press Enter to bypass the default options.
Once GParted starts, see how to partition the virtual drive.
Warning: Not all operating systems partition drives this way, but there’s a good chance you’ll see something similar. Be sure to pay attention to existing partitions when you do this – resizing, reformatting, or inadvertently deleting a partition can lead to an unbootable virtual machine.
The order of sections is very important. The drive has three partitions and 30 GB of unallocated space.
The first partition, sda1, is the boot partition or EFI system partition. The second partition, sda2, is the “primary partition”. This is the space reserved for Windows – that’s the partition we want to expand. This is seen in the image above with the red arrow and red square.
Note: In general, you can define your primary partition by size – it’s close to the total size of the original virtual drive you created.
Note that there is a third partition called sda3 directly between the partition you want to resize and the unallocated space we created earlier. sda3 status means that sda2 cannot be extended in unallocated space. The third division is actually on the way and needs to be moved first.
Right click on sda3 and click “Resize/Move”.
Class: sda3 may not be for you. You are looking for any partition between the primary partition and unallocated space.
A new window will appear allowing you to move the partition.
Pay attention to what the screen says. 30,722 MB of space after msftres partition. If you want sda3 out of the way, you need to move sda3 to the other side of the bay. Click on the previously free space, enter “30722” in the field, and click Resize/Move. It should look like this:
sda3 is now in line to be moved to the end of unallocated space, and sda2 can also be set to resize. Right-click sda2 and then click Resize/Move.
Enter the number after the maximum size in the New Size field or drag the right side of the slider to the right.
If you did it right, you should now get a “Maximum Size” value in the “New Size” box. Click “Scale/Move” to finish the conversion.
Click the green check mark button above to apply all the changes you’ve made. Depending on how many migrations or resizings you have in the queue, and the speed of your computer, it may take a few minutes for the changes to apply. Don’t panic if you have to wait a while.
After the resizing process is complete, reboot your virtual machine and remove the GParted ISO file. Windows will check that your virtual machine’s file system is working properly – do not interrupt this scan.
The virtual machine partition will now occupy the entire virtual hard disk, so you can access more space.
Note that there are easy ways to get more storage space – you can add a second virtual hard disk to your virtual machine from its settings window. You can access the contents of the other hard disk on a separate partition – for example, if you’re using a Windows virtual machine, the other virtual hard disk can be accessed on a different drive letter in your virtual machine.
“Professional coffee fan. Total beer nerd. Hardcore reader. Alcohol fanatic. Evil twitter buff. Friendly tv scholar.”