Newer versions of Windows 10 require larger amounts of free space for installation. Here's how to expand your Windows 10 virtual machine disks to prepare for your upgrade.
To install the upcoming Windows 10 May 2019 update, Windows requires 32 GB of free space, an increase from the (frankly, paltry) 16 GB needed for 32-bit versions and the 20 GB needed for the 64-bit versions. This has caused significant pain for users of Windows 10 on low-end systems with a 32 or 64 GB eMMC SSD, as those systems may not be able to upgrade without installing a new SSD—if the system supports it.
Likewise, Linux users who utilized a Windows 10 license bundled with their laptop or desktop by installing Windows 10 in a virtual machine are also likely to be troubled by this update, unless they allocated a large amount of disk space on initial setup. Without an ample amount of free space available when the update is started, updating to Windows 10 May 2019 will fail, often displaying error code 0x80070070. (Windows Update does not verify that sufficient disk space exists before starting the update.)
SEE: 20 quick Windows tips for power users (free PDF) (TechRepublic)
Rather than destroying the existing VM to expand the disk to allow for the installation, users can—with some manual effort—expand the existing disk image used with Windows 10 in a VM.
What to know before following this guide
This guide is principally for users of Windows 10 using a QEMU+KVM virtual machine, managed either with Boxes or VMM. Additional directions are also available for users of VirtualBox. Read the entire guide before performing any of these steps on your system.
How to increase virtual disk size in your VM platform
Increasing the virtual disk size in Linux is the easier part of the process.
In Boxes, right-click the Windows 10 VM, click "Properties," and click "System." Use the bottom slider to change the size of the virtual disk. Disks in Boxes expand dynamically, allowing the VM to report a larger size than is allocated on the host machine drive, but using only the real space taken up by the VM.
Manual increase (VMM)
In the terminal, navigate to the location of your virtual disk. In Fedora and RHEL, this is /var/lib/libvirt/images.
Run the following command to increase the image size by 32 GB, replacing vmdisk.img with the filename of your virtual disk. (The extension may be .qcow2, instead of .img.)
qemu-img resize win10-x64.img +32G
Refer to TechRepublic's guide to resizing a VirtualBox VM from the command line.
How to safely expand a Windows 10 partition
Even though you have expanded the disk size for your VM, this does not automatically change the properties of the Windows filesystem. This must be done manually. Previously, this could easily be done using Disk Management in Windows; however, Windows 10 inserts a recovery partition after the Windows 10 system partition. This cannot be deleted in Disk Management, making it impossible to expand the system partition.
Deleting a Windows recovery partition
Using the command line, it is possible to delete a Windows recovery partition. Assuming you have no other partitions after the active Windows 10 partition, the recovery partition should be Partition 3, using about 500 MB.
- Open a Command Prompt as an administrator, type diskpart, and press enter
- Type list disk
- Likely, you have only one virtual disk attached to your VM
- Type select disk 0
- Type list partition
- Take note of the number of the "Recovery" partition
- Type select partition #
- Type delete partition override
Expanding an active Windows 10 system partition
Without the recovery partition in the way, you are free to expand the system partition using Disk Management. Type diskmgmt.msc in the Search bar to open Disk Management, right click the Windows volume, and click Expand.
The deleted recovery partition will (likely) be regenerated on the next boot, or next time Windows Update is run.
For more on Windows 10, check out "Windows 10 May 2019 Update: Everything you need to know," and TechRepublic's cheat sheet for Windows 10.