Systems Admin

Hyper-V: Convert a VHD to VHDX (Detach First, Then Edit Disk)

You have a Hyper-V VM with a legacy VHD-format disk. Maybe it migrated from an old Server 2008 R2 host, maybe someone created it manually before VHDX became the default in 2012. Either way, you’ve hit one of VHD’s limits (2 TB cap, no power-loss resilience, suboptimal block alignment) and want to upgrade it to VHDX without losing data. Hyper-V’s Edit Disk wizard does this in one shot — the only catch is that the disk has to be detached from the VM first because vmwp.exe holds the file open. This post walks the GUI flow and the PowerShell equivalent end-to-end.

Why upgrade VHD to VHDX

Feature VHD (legacy) VHDX (modern)
Max size 2 TB hard cap 64 TB
Power-loss resilience None — corruption possible Internal log + checksums
Logical sector size 512 B 4 KB (aligns with modern arrays)
Shared VHDX (guest cluster) Not supported Supported
Hot-resize Limited Yes for both Fixed and Dynamic
Generation 2 VM boot Not supported Required

The 2 TB cap is the most common trigger — a VHD volume runs out of space, you try to grow it, and Disk Management refuses because you’re at the format limit. Upgrade to VHDX and you can grow further. The other features are nice-to-haves; the size cap is what actually forces the conversion most of the time.

The procedure in one paragraph

Shut down the VM (or just detach the disk from the VM’s settings while leaving the VM running). Run the Edit Disk wizard from Hyper-V Manager, point it at the .vhd file, pick Convert, choose VHDX as the output format, name the new file. Wizard reads the .vhd, writes a new .vhdx, leaves the original .vhd in place. Reattach the new .vhdx to the VM. Done. Original .vhd file can be deleted once you’ve verified the VHDX works.

The catch: the disk MUST be detached during the conversion because Hyper-V’s worker process holds the file open while the VM is using it. Trying to convert an attached disk fails with a “file in use” error.

The demo setup

For the walk-through, we create a fresh VHD just so we have something to convert. In real use you skip these prep steps because you already have an existing VHD that needs upgrading.

Hyper-V Manager Action pane on the host with New highlighted and Hard Disk option visible in the submenu, the entry point into the New Virtual Hard Disk wizard used here to fabricate a legacy VHD for the conversion demo
Demo setup — create a fresh VHD via Hyper-V Manager > Action > New > Hard Disk. In real use, you almost never create a NEW VHD — this is just so we have a target to convert.

Hyper-V Manager > Action pane > New > Hard Disk. The standard New Virtual Hard Disk wizard opens.

New Virtual Hard Disk wizard Disk Format page with the VHD radio option selected (instead of the modern VHDX default) for the demo, the explicit choice that creates the legacy file format we will later convert
On the Disk Format page, pick VHD instead of the (default) VHDX. This is the only place in the wizard where the format choice surfaces; everything else is identical to creating a VHDX.

On the Disk Format page, pick VHD instead of the default VHDX. This is the only place where the format choice surfaces — the rest of the wizard is identical regardless.

New Virtual Hard Disk wizard Specify Name and Location page with a filename and target folder entered, the standard naming step that determines where the .vhd file will be created on the host filesystem
Name and location — standard. Pick a folder on a host drive with capacity. Convention: D:\VMDisks\<vm-name>\<disk-purpose>.vhd.

Name and location — standard. Use a folder on a host drive with capacity. Convention: D:\VMDisks\<vm-name>\<disk-purpose>.vhd.

New Virtual Hard Disk wizard Configure Disk page with the size field populated and the Fixed-vs-Dynamic radio option visible, the size and allocation choice that will be carried over when the VHDX is later created
Pick the size and Fixed-vs-Dynamic. For demo purposes, small + Dynamic is fine. The conversion preserves whatever you pick — if you start with a Dynamic VHD, you can choose Dynamic or Fixed for the output VHDX.

Pick size and Fixed-vs-Dynamic. For the demo, small + Dynamic is fine.

Hyper-V Manager VM Settings dialog with the SCSI Controller node expanded and the freshly created VHD attached to a virtual machine, the as-running configuration that the conversion will require us to undo
Attach the VHD to a VM via VM Settings > SCSI Controller > Hard Drive > Add > pick the .vhd file. This is the “already attached” state we’ll need to undo for the conversion.

Attach the new VHD to a VM via VM Settings > SCSI Controller > Hard Drive > Add > Virtual hard disk > pick the .vhd. This is the “real-world” starting state — a VHD attached to a running VM.

Guest VM Disk Management console showing the freshly attached VHD as Disk N in an Offline / Unknown / Not Initialized state with the unallocated space visible, confirming the VM sees the legacy disk and that no data has been written yet
Inside the running VM, the VHD shows up in Disk Management as a fresh disk. We’re not going to use the disk for anything — just confirming the VM sees it before we try the conversion.

Inside the VM, the VHD shows up in Disk Management as a fresh disk. We’re not going to use it for anything — just confirming the VM sees it.

Step 1 — first attempt fails (the “file in use” lesson)

From the host, try the conversion while the VHD is still attached. Hyper-V Manager > Edit Disk (in the right Actions pane) > pick the .vhd file > Convert.

Edit Virtual Hard Disk wizard run from the host while the VHD is still attached to the running VM, with the Convert action queued, the configuration that triggers the file-in-use error in the next screenshot
Try Edit Disk while the VHD is attached. From the host: Hyper-V Manager > Edit Disk > pick the .vhd file > Convert. Wizard runs through.

Wizard runs through… and fails.

Error dialog returned by the Edit Disk wizard reporting that the file is in use by another process, the explicit failure that confirms an attached disk cannot be converted in place
Wizard fails with a “file in use” error. Hyper-V’s vmwp.exe holds the file open while the disk is attached to a running VM — the conversion needs exclusive access to write the new format. Detach is mandatory.

Error: the file is in use by another process. The “another process” is Hyper-V’s worker process (vmwp.exe) which holds the disk open exclusively while the VM is running. Conversion needs exclusive access to write the new file.

This is the lesson. Detach first, convert second. The error is harmless — nothing is corrupted; the conversion just didn’t happen.

Step 2 — detach the disk

VM Settings > SCSI Controller > select the Hard Drive entry > Remove > Apply.

Hyper-V Manager VM Settings dialog with the Hard Drive entry highlighted and the Remove button about to be clicked, the corrective step that detaches the VHD from the VM so the conversion can proceed
VM Settings > SCSI Controller > select the Hard Drive entry > Remove > Apply. The .vhd file is no longer attached to the VM but the file itself stays on disk — you’re only removing the attachment, not the file.

You’re only removing the attachment, NOT the file. The .vhd file remains on the host filesystem; the VM no longer has a reference to it. The VM continues running (now with one less disk).

Alternative: shut down the VM entirely. The conversion works either way. For VMs that can tolerate a brief outage, shutting down is simpler. For VMs that can’t, just detach the specific disk and leave the VM running.

Step 3 — run Edit Disk wizard, this time successfully

Hyper-V Manager > Edit Disk > pick the .vhd file again > Convert.

Edit Virtual Hard Disk wizard re-run after the disk was detached, with the Convert action selected and the destination VHDX path field populated, the second-attempt run that completes successfully now that the file is no longer locked by Hyper-V
Edit Disk wizard run again, this time with the disk detached. Convert option proceeds — the wizard reads from the .vhd, writes a new .vhdx file, and leaves the original .vhd in place. Conversion time scales with disk size: a few minutes per 100 GB on local SATA.

This time the wizard advances:

  1. Choose Action: pick Convert (other options are Compact, Expand, Merge — not what we want here).
  2. Choose Disk Format: pick VHDX.
  3. Choose Disk Type: pick Fixed or Dynamic. The choice is independent of what the source VHD was — you can convert a Dynamic VHD to a Fixed VHDX or vice versa. For production, Fixed; for general-purpose, Dynamic.
  4. Configure Disk: name and location for the new .vhdx file. By convention, same folder as the source with the .vhdx extension.
  5. Summary: review and Finish.

The wizard reads the .vhd, writes the .vhdx, and shows a progress bar. Time to convert scales with disk size:

  • 10 GB on local SATA: ~30 seconds
  • 100 GB on local SATA: 5–10 minutes
  • 1 TB on local SATA: ~1 hour
  • NVMe is much faster; network storage is much slower

The original .vhd file is left in place — the conversion is non-destructive on the source side. You can verify the VHDX works before deleting the .vhd.

Step 4 — reattach the new VHDX

VM Settings > SCSI Controller > Hard Drive > Add > Virtual hard disk > browse to the new .vhdx file (NOT the original .vhd) > Apply.

Hyper-V Manager VM Settings dialog with a new Hard Drive entry pointing at the freshly converted .vhdx file, the reattach step that restores the disk to the VM with the new format under the same SCSI controller
Reattach the new .vhdx to the VM via the same SCSI Controller path. Pick Virtual hard disk > browse to the .vhdx (NOT the old .vhd). Apply.

The VM gets the disk back, but now in VHDX format. If the VM was still running during the detach + convert + reattach sequence, the disk just hot-attaches; no boot needed.

Step 5 — verify in the guest

Inside the VM, open Disk Management again.

Guest VM Disk Management console showing the converted VHDX as Disk N with the same data state as before the conversion, the verification confirming the conversion preserved disk content and the guest sees an equivalent disk under the new format
Inside the VM, Disk Management shows the same disk under the new format. If the VHD had data on it before the conversion, the data is preserved in the VHDX — the conversion is non-destructive on the source side. Once you confirm the VHDX works, delete the original .vhd file from the host filesystem to free space.

The disk should appear with the same data state as before the conversion. If the VHD had a partition table, volumes, and data, the VHDX has them too — the conversion preserved everything.

Once you’ve confirmed the VHDX works correctly:

  • Delete the original .vhd file from the host filesystem to reclaim space.
  • If this VHD was the only one referenced in your backup config, update the backup config to point at the new .vhdx file.

The PowerShell one-liner

For batch conversions of many disks, the GUI gets tedious. PowerShell:

Convert-VHD -Path "C:\OldDisks\disk01.vhd" -DestinationPath "C:\NewDisks\disk01.vhdx" -VHDType Fixed

Same constraints as the GUI: the source disk MUST NOT be attached to a running VM. Wrap in a loop for multiple disks:

Get-ChildItem "C:\OldDisks\*.vhd" | ForEach-Object {
    $dest = $_.FullName -replace '\.vhd$', '.vhdx'
    try {
        Convert-VHD -Path $_.FullName -DestinationPath $dest -VHDType Fixed
        Write-Host "Converted: $($_.Name)"
    } catch {
        Write-Warning "Failed: $($_.Name) - $($_.Exception.Message)"
    }
}

For very large batches, run sequentially — parallel conversions saturate disk I/O and don’t complete faster than serial.

Things that bite people

Trying to convert while the VM is running and the disk is attached

The classic. Wizard fails with “file in use.” Either detach the disk from the VM (no need to shut down) or shut down the VM. Same fix either way.

Confusing Convert with Compact, Expand, or Merge

Edit Disk wizard offers four operations:

  • Compact — reclaim space in a Dynamic disk (zero out unused blocks). Doesn’t change format.
  • Expand — increase the maximum size. Doesn’t change format.
  • Merge — combine a differencing disk into its parent. Doesn’t change format.
  • Convert — change format (VHD ↔ VHDX) or type (Fixed ↔ Dynamic). This is what you want.

Pick Convert. The other three are different operations.

Forgetting that Generation 2 VMs require VHDX

If your VM is Generation 2 (Hyper-V’s modern UEFI-based VM type) you can’t boot from a VHD — only VHDX is supported. If a Gen 2 VM has a VHD attached as a data disk, it works fine; but the boot disk MUST be VHDX. If you’re moving a Gen 1 VM’s boot disk to a Gen 2 VM, convert to VHDX first.

Disk space for the conversion

The conversion creates a NEW file alongside the existing one — for the duration of the conversion, you need free space equal to (or greater than) the size of the source disk. For a 1 TB Fixed VHD being converted to a Fixed VHDX, you need at least 1 TB free on the destination drive. Check before starting.

Backup config still points at the old .vhd

You convert, reattach, delete the old .vhd, and your nightly backup fails because it’s still configured to back up the old .vhd path. Update the backup config when you change the disk file. Same applies to any monitoring or scripts that reference the disk by path.

Differencing disks need their parent converted too

If you have a differencing VHD with a VHD parent, converting just the differencing disk doesn’t convert the parent. The chain still references VHD format throughout. To fully migrate to VHDX, either:

  • Merge the differencing disk into the parent first (Merge operation), then convert the consolidated disk.
  • OR convert the parent disk separately, then update the differencing disk to point at the new parent.

Plan the chain before starting.

Checkpoints prevent conversion

If the VM has checkpoints (snapshots), the disk file is part of a chain (each checkpoint creates a differencing disk). The conversion only works on the BASE file, not the checkpoint chain. Delete checkpoints first via Hyper-V Manager > right-click VM > Delete Checkpoint > Apply now (this merges the chain back to the base), THEN convert.

Conversion is one-way (in practice)

Convert-VHD can convert VHDX back to VHD too, but this is almost never useful — the VHD format limits will reassert themselves. Default direction is VHD → VHDX; the reverse direction is for very specific compatibility scenarios with legacy hosts.

Where this fits

VHD-to-VHDX conversion is a once-per-disk operation that you do when you bump into one of VHD’s limits. Combined with the previous post on attaching disks to VMs and the storage migration posts in the Hyper-V Virtualization pathway, this rounds out the “managing virtual disks” story for Hyper-V deployments. For broader Hyper-V context including VM creation, replica, and live migration, see the rest of the pathway.

Leave a Reply