How to Expand a Virtual Disk in VMware or VirtualBox
This guide shows you how to increase the size of a virtual machine’s hard disk in VMware Workstation/Player or Oracle VirtualBox. You’ll learn the steps to enlarge the virtual disk file itself, then how to make the guest operating system recognize and use the extra space. Before starting, back up your VM or at least the disk file, and make sure you have enough free space on the host drive.
What You’ll Need
- Administrator or root access to the host operating system.
- Administrator or root access inside the guest OS (to extend the partition).
- Enough free space on the host’s physical disk to accommodate the new size.
- A backup of the virtual machine (or at least the .vmdk/.vdi file) before making changes.
- For VMware: the
vmware-vdiskmanagertool (Windows) or thevmware-vdiskmanagercommand (Linux) – usually installed with VMware Workstation/Player. - For VirtualBox: the
VBoxManagecommand, which comes with VirtualBox.
Step-by-Step
For VMware Workstation or Player
- Shut down the virtual machine completely. Do not suspend it; a suspended state can cause errors during resizing.
- Locate the virtual disk file – usually a .vmdk file in the VM’s folder. If you have a snapshot, you may need to consolidate or delete snapshots first, because resizing a disk with snapshots can be problematic.
- Open a command prompt or terminal with administrator privileges.
- Use the VMware disk manager tool to expand the disk. For example, on Windows:
"C:\Program Files (x86)\VMware\VMware Workstation\vmware-vdiskmanager.exe" -x 80GB "C:\VMs\MyVM\MyVM.vmdk"
On Linux, the command is similar:
vmware-vdiskmanager -x 80GB /path/to/MyVM.vmdk. Replace80GBwith your desired new size and adjust the path to your .vmdk file. - Wait for the tool to finish. It will report the new disk size. Do not interrupt the process.
- Start the virtual machine and boot into the guest OS.
- Extend the partition inside the guest OS (see “Extending the Guest Partition” below).
For VirtualBox
- Shut down the virtual machine completely.
- Open a command prompt or terminal on the host.
- Use VBoxManage to resize the disk. For a .vdi disk:
VBoxManage modifymedium disk "C:\VMs\MyVM\MyVM.vdi" --resize 81920
The size is in megabytes, so 81920 MB = 80 GB. For a .vmdk disk, use the same command with the .vmdk path.
- If the disk is a VHD, use
--resizeas well. For VDI, VMDK, and VHD, the command works the same. - Start the VM and boot into the guest OS.
- Extend the partition inside the guest OS as described below.
Extending the Guest Partition
- Open Disk Management on Windows (right-click Start → Disk Management) or use
gparted/fdiskon Linux. - Find the disk that was enlarged – it will show unallocated space after the existing partition.
- Right-click the existing partition and choose “Extend Volume” (Windows) or use GParted to resize the partition to fill the unallocated space.
- Apply the changes. On Windows, the volume will extend immediately. On Linux, you may need to run
resize2fsfor ext4 orxfs_growfsfor XFS after resizing the partition. - Verify the new size by checking the disk properties in the OS.
Common Mistakes
- Not shutting down the VM – resizing while the VM is running or suspended can corrupt the disk.
- Forgetting about snapshots – VMware and VirtualBox may refuse to resize disks that have snapshots. Delete or merge snapshots first.
- Confusing MB with GB – VirtualBox uses megabytes, so 80 GB is 81920 MB, not 80 MB.
- Resizing the wrong disk – if you have multiple disks, ensure you pick the correct .vmdk/.vdi file.
- Not extending the partition inside the guest – the guest OS won’t automatically use the new space; you must extend the partition and filesystem.
- Using a tool that doesn’t match the disk type – for example, using VMware’s tool on a VirtualBox disk or vice versa. Use the appropriate tool for your hypervisor.
Tips
- Always back up before resizing. A simple copy of the VM folder is sufficient for a test VM, but for production, use a proper backup or snapshot.
- Defragment the guest OS before resizing if the disk is nearly full – this can speed up the process and reduce the chance of errors.
- Use a live GParted ISO if the guest OS partition is the system partition and you can’t extend it while the OS is running.
- For VMware, you can also use the GUI – go to VM Settings → Hard Disk → Utilities → Expand, and enter the new size. This works in Workstation and Player.
- For VirtualBox, you can use the GUI – File → Virtual Media Manager → select the disk → Properties → Size, and drag the slider.
- If you’re using a thin-provisioned disk, the file on the host may be smaller than the virtual size. Expanding the virtual size does not immediately allocate that space on the host; it will grow as the guest writes data.
Troubleshooting
- “The disk is too large” or “Invalid size” error – Make sure you’re using the correct units (MB vs GB) and that the new size is larger than the current size. Also check that the disk is not larger than the maximum supported by the hypervisor (e.g., 2 TB for some formats).
- “Disk is in use” or “Cannot lock the disk” – Ensure the VM is fully powered off, not suspended. Also close any file explorer windows that might be accessing the disk file.
- “Snapshot exists” error – Delete or merge snapshots. In VMware, you can do this via Snapshot Manager. In VirtualBox, use the Snapshots view to delete them.
- After resizing, the guest OS still shows the old size – You forgot to extend the partition inside the guest. Follow the “Extending the Guest Partition” steps again.
- Windows “Extend Volume” is greyed out – This happens if the partition is not immediately after the unallocated space, or if the disk is MBR and the unallocated space is beyond the 2 TB limit. You may need to use a third-party tool like GParted, or convert to GPT.
- Linux doesn’t see the new space – Run
partprobeor reboot the VM. Then usefdisk -lto confirm the disk size, and resize the partition withpartedorgrowpart.
Frequently Asked Questions
Can I expand a virtual disk while the VM is running?
No. You must shut down the VM completely. Resizing a disk while the VM is running can corrupt the filesystem.
Do I need to expand the partition inside the guest OS?
Yes, absolutely. The virtual disk is just a container; the guest OS must be told to use the extra space by extending its partition and filesystem.
Will expanding a disk affect my data?
If done correctly, no. But there is always a risk, so a backup is strongly recommended. The process only adds space; it does not modify existing data.
Can I shrink a virtual disk?
Shrinking is possible but more complex and risky. VMware’s tool can shrink a disk, but VirtualBox does not support shrinking VDI files. It’s generally safer to create a new, smaller VM and migrate data.
What is the maximum disk size for VMware and VirtualBox?
For VMware, the maximum is typically 2 TB for a single virtual disk (VMDK). For VirtualBox, VDI supports up to 2 TB, and VMDK also up to 2 TB. Some newer versions support larger, but 2 TB is a safe limit.
Do I need to expand the disk if I just want more space in the guest?
Yes, unless you add a new virtual disk instead. Adding a new disk is often easier and less risky than resizing an existing one, but it creates a separate partition that you must mount or assign a drive letter.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.