Expanding Virtual Hard Disks with Hyper-V
One of the most frequent questions I see on forums and newsgroups that deal with virtualization is the age-old question of “I have used all the space inside a VHD hard disk. How do I expand the virtual hard disk to make room for additional data?”. Luckily for us, with Microsoft Hyper-V on Windows Server 2008, this is now possible. Hyper-V now adds the ability to increase the maximum size of a virtual hard disk. Expanding the disk increases the storage capacity of a dynamically expanding virtual hard disk or a fixed virtual hard disk.
Before using the ability to expand the VHD hard disk you must take the following issues into consideration:
- You must first completely shut down the virtual machine. You cannot expand a virtual hard disk that is associated with a running or saved stated virtual machine.
- If you expand a virtual hard disk that is associated with a virtual machine that has snapshots, these snapshots will be invalidated. If you need the snapshots, you’d better make sure you plan ahead of time, and/or create new snapshots after performing the expansion of the hard disk.
Make sure no snapshots are associated with this VM.
- After expanding the virtual hard disk there will be an empty space at the end of the virtual hard disk, just like not using the entire disk when you’ve originally created partitions in it. You will either need to create a new partition to use the new space, or expand an existing partition into the new space.
Note: Expanding or extending partitions on Windows Vista and Windows Server 2008 is easier than on Windows Server 2003 or Windows XP, and is performed by using either the Disk Management snap-in from the Computer Management tool, or by using the DISKPART command. Please read my How to Extend a Disk Partition in Windows Vista and Server 2008 article for more information.
Follow these steps to expand VHD hard disks:
- Open the Hyper-V management tool from the Administrative Tools folder (or by typing virtmgmt.msc in the Run command).
- Start the Edit Virtual Hard Disk wizard by selecting Edit Disk…
- If the Before you begin window appears, click Next.
- Select the virtual hard disk you want to expand. Click Open and then Next.
- Select Expand on the Choose Action page and then press Next.
- Enter the new size of the virtual hard disk that you want and then press Next.
- In the final screen, press Finish.
- Wait till the operation finishes, which should be quite fast.
Next, after booting the VM, use Disk Management snap-in from the Computer Management tool, or by using the DISKPART command to expand the partition within Windows. While possible in Windows Server 2008 and Windows Vista, unfortunately, in Windows 2000/XP/2003, you cannot use the built-in tools to expand the System Partition (the one the Windows operating system is installed on). For these versions you will need to use of these free partition utilities.
Recent Windows Server 2008 Forum threads
Got a question? Post it on our Windows Server 2008 forums!
More in Hyper-V
How to Install Hyper-V on Windows Server Core
Mar 16, 2022 | Michael Reinders
Microsoft Says There Will Be No Hyper-V Server 2022 Free Edition
Dec 13, 2021 | Michael Reinders
How to Stop an Unresponsive Hyper-V Virtual Machine
Jun 29, 2021 | Russell Smith
How to Enable Nested Virtualization in Hyper-V
Jun 28, 2021 | Russell Smith
Disaster Recovery with Azure Backup for SQL Server VMs
May 28, 2019 | Michael Otey
Leveraging Virtualization for Improved Availability and Disaster Recovery
Apr 29, 2019 | Michael Otey
Most popular on petri