How to Enlarge a Virtual Machine Disk in VirtualBox or VMware – Yalla Match

Tenaht /

When you create a virtual hard disk in VirtualBox or VMware, you specify the maximum disk size. If you want more hard disk space for your virtual machine later, you will have 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 keep 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 resize it. Click Apply when done.

You still have to enlarge the partition on the disk to take advantage of the extra space. The partition remains the same size even as the disk size increases. See the instructions below for more information about enlarging the partition.

Enlarge a virtual disk in VirtualBox using the command line

To enlarge a virtual disk in VirtualBox, you will need to use the VBoxManage command from the Command Prompt window. First, shut down the virtual machine – make sure its status is set to “off,” not “saved.”

Class: Before proceeding, you should also delete any snapshot files associated with the virtual machine if you are using the snapshot feature of VirtualBox. This will ensure that the correct virtual disk file has been modified and that everything will work correctly afterwards.

Virtual machines currently installed on the PC.

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 FilesOracleVirtualBox"

The following command will run on a VirtualBox virtual disk located in “C:UsersEquinoxVirtualBox VMsWindows 10Windows 10.vdi”. The virtual disk size will be changed to 81,920 MB (80 GB).

VBoxManage modifyhd "C:UsersChrisVirtualBox VMsWindows 10Windows 7.vdi" --resize 81920

Class: I used two dashes before Resize in the above command.

Replace the file path in the above command with the location of the VirtualBox disk you want to resize and the number to the size you want to enlarge 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:UsersEquinoxVirtualBox VMsWindows 10Windows 10.vdi" --resize 81920

Command Prompt command to change the size of the virtual drive.

Note that this process does not enlarge the partition on the virtual hard disk, so you will not be able to access the new space yet – see the Enlarge the virtual machine partition below for more information.

Virtual Disk Enlargement in VMware

To enlarge the hard disk of a virtual machine in VMware, turn off the virtual machine, right-click on it, and select Virtual Machine Settings.

Select the virtual hard disk device in the list, click the Utilities button, and 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 on expanding the partition.

Enlarge the virtual machine partition

You now have a larger virtual hard disk. However, the OS partition on your virtual hard disk is the same size, so you won’t be able to access any of that space yet.

The Disk Management utility will show you the new available space on the virtual drive.

Now you will need to extend the guest OS partition as if you were extending a partition on a real hard disk in a physical computer. You cannot enlarge the partition while the guest operating system is running, just as you cannot enlarge the C: partition while Windows is running on your computer.

You can use a GParted live CD to resize your virtual machine’s partition—just run a GParted ISO image in your virtual machine and you’ll be taken to the GParted partition editor in a live Linux environment. GParted will be able to enlarge the partition on the virtual hard disk.

First, download the GParted Live CD ISO file from here.

Load the ISO file into your virtual machine by going to the virtual machine settings window, choosing the virtual CD drive, and browsing to the ISO file on your computer.

Boot (or restart) your virtual machine after inserting the ISO image and the virtual machine will boot from the ISO image. The GParted Live CD will ask you several questions during boot – you can press Enter to skip the default options.

Once GParted boots up, take a look at how to partition the virtual drive.

GParted will show you how to partition a virtual drive.

warning: Not all operating systems will partition drives this way, but there’s a good chance you’ll see something similar. Make sure to pay attention to existing partitions when you do this – resizing, reformatting, or carelessly deleting a partition can result in an unbootable virtual machine.

The order of the sections is very important. There are three partitions on the drive, plus 30 GB of unallocated space.

The first partition, sda1, is the boot sector or EFI system partition. The second partition, sda2, is the “primary partition”. It’s the space allotted to Windows – that’s the partition we want to expand. It is observed with the red arrow and red square in the image above.

NB: In general, you can define your primary partition by size – it will be close to the total size of the original virtual drive you created.

Be sure to note that there is a third partition, sda3, directly between the partition you want to resize and the unallocated space we created earlier. The sda3 position means that we can’t just extend sda2 in the unallocated space. The third section is actually on the way, and we have to move it first.

Right click on sda3, then click on “Resize/Move”.

Class: sda3 may not be for you. You are just looking for any partition that is between the primary partition and the unallocated space.

A new window will appear allowing you to move the partition.

There is not much free space tracking sda3.

Notice what the screen says. There is 30,722 MB of space after the msftres partition. If you want sda3 to be out of the way, we need to move sda3 all the way to the other side of the available space. Click the Previous Free Space box, enter “30722” in the field, then click Resize/Move. It should look like this:

sda3 is now queued to be moved to the end of unallocated space, and we can also set sda2 to be resized. Right click on sda2, then click on Resize/Move.

Enter the number after Maximum Size in the New Size field, or drag the right side of the slider to the far right.

If you did it correctly, you should get the “Maximum Size” value in the “New Size” box now. Click “Resize/Move” to finish the change.

Click the green check mark button near the top to apply all the changes you made. It may take a few minutes for the changes to apply, depending on how many transfers or resizes you’ve queued, and how fast your computer is. Don’t be alarmed if you have to wait a while.

After the resizing process is complete, restart your virtual machine and remove the GParted ISO file. Windows will check the file system of your virtual machine to make sure it is working properly – do not interrupt this scan.

Do not skip any of the repair procedures or chkdsk that Windows runs after resizing your partitions.

The virtual machine partition will now occupy the entire virtual hard disk, so you will have access to the additional space.

Note that there are easier ways to get more storage – 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 are using a Windows virtual machine, the other virtual hard disk will be accessible on a different drive letter within your virtual machine.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent News

Editor's Pick