Hyper-V is a virtualization platform developed by Microsoft that allows users to create and manage virtual machines. One of the common tasks when managing VMs is managing disk space. In the process of using a virtual machine, as the system runs and data accumulates, the disk space may gradually be exhausted, causing the virtual machine to run slowly or be unable to continue to store new data. This article will introduce in detail the solution to the problem of insufficient virtual machine disk space to help users quickly restore the normal operation of the virtual machine.
In Hyper-V, you can expand a virtual hard disk to increase the storage capacity available to a virtual machine. Expanding a Hyper-V VM disk involves increasing the size of the virtual hard disk (VHD or VHDX file) associated with a virtual machine.
There are 2 ways to expand a Hyper-V VM disk.
Expand Hyper-V VM disk using Hyper-V Manager
1. In the Hyper-V Manager, click on the VM you want to modify in the list of virtual machines.
2. Edit the Virtual Hard Disk:
Right-click on the VM and select Settings.
Under the Hardware list, select the hard drive you want to expand.
Click on the “Edit” button within the “Virtual hard disk” area.
3. In the Edit Virtual Hard Disk Wizard, select the “Expand” option and click Next.
4. Enter the new size for the virtual hard disk. The size you enter will be the new maximum size for the virtual hard disk.
5. Click Next and then finish to apply the changes.
6. Extend the volume within the VM:
After expanding the virtual hard disk, you need to extend the volume within the guest operating system to make use of the new space.
Start the VM, log in, and use the Disk Management tool to extend the volume. Right-click the partition you want to extend and select “Extend Volume”.
Then follow the Extend Volume Wizard to finish the whole process.
Expand Hyper-V VM disk using PowerShell
If you prefer using PowerShell, you can accomplish the same task with the following steps:
1. Open PowerShell as an Administrator.
2. Get the VHD/VHDX File Path:
Use the “Get-VMHardDiskDrive” command to find the path to the VHD/VHDX file you want to expand.
Get-VMHardDiskDrive -VMName “YourVMName”
3. Expand the VHD/VHDX File:
Use the “Resize-VHD” command to resize the disk. Replace “PathToVHD” and “NewSize” with your actual situation.
Resize-VHD -Path "C:PathToVHDDiskName.vhdx" -SizeBytes NewSize
4. Extend the volume within the VM:
After expanding the virtual hard disk, you also need to start the VM and extend the volume using Disk Management as described above.
How to fully protect Hyper-V environment?
Before performing these operations, it is recommended to back up your Hyper-V VMs in case something goes wrong and results in data loss.
Vinchin Backup & Recovery is a professional solution which supports data backup of VM like VMware vSphere, Hyper-V, XenServer, XCP-ng, oVirt, RHV, OpenStack, Proxmox, etc. and other data like database, NAS, file server, Linux & Windows Server, etc.
Tailored for virtual environments, it offers automated backups, agentless backup, LAN/LAN-Free options, offsite copying, instant recovery, data deduplication, and cloud archiving. By following the 3-2-1 backup rule, Vinchin ensures robust data security. With data encryption and ransomware protection, it provides dual insurance for Hyper-V VM backups and supports easy migration between Hyper-V and other platforms.
It only takes 4 steps to backup Hyper-V VMs with Vinchin Backup & Recovery:
1. Select the backup object.
2. Select backup destination.
3. Select backup strategies.
4. Review and submit the job.
Vinchin Backup & Recovery has been selected by thousands of companies and you can also start to use this powerful system with a 60-day full-featured trial! Also, contact us and leave your needs, and then you will receive a solution according to your IT environment.
Hyper-V disk expanding FAQs
1. Q: How do I free up space on Hyper-V?
A: Here are some general strategies to free up space:
Delete Unused Virtual Machines
Delete Snapshots (Checkpoints)
Enable Dynamic Memory
2. Q: What is the difference between expanding a VHD and a VHDX file?
A: VHDX is a newer format that supports larger disk sizes (up to 64 TB), is more resilient to power failure events, and can be expanded while the VM is running. VHD is an older format with a maximum size of 2 TB and generally requires the VM to be offline to resize.
Conclusion
Managing disk space is a critical aspect of virtual machine administration, and Hyper-V provides flexible options for expanding virtual hard disks when additional storage is needed. The process can be accomplished through either the Hyper-V Manager or PowerShell, each offering a straightforward workflow. With Hyper-V Manager, the graphical interface guides you through expanding the disk, while PowerShell commands provide a scriptable and often faster alternative for experienced users.
Share on: