Mount or Unmount VHD or VHDX File in Windows 10  

Page 1 of 3 123 LastLast
    Mount or Unmount VHD or VHDX File in Windows 10

    Mount or Unmount VHD or VHDX File in Windows 10

    How to Mount or Unmount VHD and VHDX File in Windows 10
    Published by Category: Virtualization
    25 Oct 2023
    Designer Media Ltd

    How to Mount or Unmount VHD and VHDX File in Windows 10


    VHD (Virtual Hard Disk) is a file format which represents a virtual hard disk drive (HDD). It may contain what is found on a physical HDD, such as disk partitions and a file system, which in turn can contain files and folders. It is typically used as the hard disk of a virtual machine.

    VHDX is a Hyper-V virtual hard disk file format. VHDX has a much larger 64 TB storage capacity than the older VHD format 2TB limit. It also provides data corruption protection during power failures and optimizes structural alignments of dynamic and differencing disks to prevent performance degradation on new, large-sector physical disks.

    When you mount a .vhd or .vhdx file, it will be added as a drive in This PC to open it from.

    This tutorial will show you different ways on how to natively mount or unmount VHD and VHDX virtual hard disk files in Windows 10.

    You must be signed in as an administrator to be able to mount and unmount VHD and VHDX files.

    VHD and VHDX files cannot be mounted on removable media that isn't formatted with NTFS or ReFS file system.



    Contents




    EXAMPLE: Mounted VHDX file in This PC
    Mount or Unmount VHD or VHDX File in Windows 10-mounted_vhd-vhdx.png





    OPTION ONE

    Directly Mount VHD or VHDX file


    1 Do step 2 or step 3 below for what you would like to do.

    2 Double click/tap on the .vhd or .vhdx file.

    3 Right click or press and hold on the .vhd or .vhdx file, and click/tap on Mount. (see screenshot below)
    Mount or Unmount VHD or VHDX File in Windows 10-mount_vhd-vhdx-context-menu.png






    OPTION TWO

    Mount VHD or VHDX file in Disk Management


    1 Open Disk Management (diskmgmt.msc).

    2 Click/tap on Action in the menu bar, and click/tap on Attach VHD. (see screenshot below)

    Mount or Unmount VHD or VHDX File in Windows 10-attach_vhd-vhdx_disk_management-1.jpg

    3 Click/tap on Browse, navigate to and select the .vhd or .vhdx file, click/tap on Open, check or uncheck Read-only, and click/tap on OK. (see screenshots below)

    Mount or Unmount VHD or VHDX File in Windows 10-attach_vhd-vhdx_disk_management-2.jpg

    4 You can now close Disk Management if you like.






    OPTION THREE

    Mount VHD or VHDX file in Windows PowerShell


    For more details and options for the Mount-VHD cmdlet, see: Microsoft Docs: Mount-VHD

    This command is only available after installing the Hyper-V Management Tools or Hyper-V feature.


    1 Open an elevated Windows PowerShell.

    2 Type the command below into the elevated Windows PowerShell, and press Enter. (see screenshot below)

    Mount-VHD -Path "Full path of .vhd or .vhdx file"

    Substitute Full path of .vhd or .vhdx file in the command with the actual full path of the .vhd or .vhdx file you want to mount.

    For example: Mount-VHD -Path "C:\Users\Brink\Desktop\Non-Insider W10.vhdx"

    Mount or Unmount VHD or VHDX File in Windows 10-mount-vhd_powershell.png

    3 You can now close the elevated Windows PowerShell if you like.






    OPTION FOUR

    Mount VHD or VHDX file in Command Prompt


    1 Open an elevated command prompt.

    2 Type diskpart into the elevated command prompt, and press Enter. (see screenshot below)

    3 Type the command below into the elevated command prompt, and press Enter.

    select vdisk file="Full path of .vhd or .vhdx file"

    Substitute Full path of .vhd or .vhdx file in the command with the actual full path of the .vhd or .vhdx file you want to mount.

    For example: select vdisk file="D:\VHD\Example.vhdx"


    4 Type attach vdisk into the elevated command prompt, and press Enter.

    5 You can now close the elevated command prompt if you like.

    Mount or Unmount VHD or VHDX File in Windows 10-mount_vhd_command.png






    OPTION FIVE

    Unmount VHD or VHDX file using Eject


    1 Open This PC in File Explorer (Win+E).

    2 Right click or press and hold on the drive for the mounted .vhd or .vhdx file, and click/tap on Eject. (see screenshot below)
    Mount or Unmount VHD or VHDX File in Windows 10-eject_vhd-vhdx.png






    OPTION SIX

    Unmount All VHD and VHDX files by Restarting Computer


    1 Restart the computer to automatically unmount all VHD and VHDX files at once.






    OPTION SEVEN

    Unmount VHD or VHDX file in Disk Management


    1 Open Disk Management (diskmgmt.msc).

    2 Right click or press and hold on the Disk # for the mounted .vhd or .vhdx file, and click/tap on Detach VHD. (see screenshot below)

    Mount or Unmount VHD or VHDX File in Windows 10-detach_vhd-vhdx_disk_management-1.jpg

    3 Click/tap on OK to confirm. (see screenshot below)

    Mount or Unmount VHD or VHDX File in Windows 10-detach_vhd-vhdx_disk_management-2.png

    4 You can now close Disk Management if you like.






    OPTION EIGHT

    Unmount VHD or VHDX file in Windows PowerShell


    For more details and options for the Dismount-VHD cmdlet, see: Microsoft Docs: Dismount-VHD

    This command is only available after installing the Hyper-V Management Tools or Hyper-V


    1 Open an elevated Windows PowerShell.

    2 Type the commands below one at a time into the elevated Windows PowerShell, and press Enter after each command. Make note of the Disk # and/or file path of the .vhd or .vhdx file you want to unmount. (see screenshot below)

    diskpart

    list vdisk

    exit

    Mount or Unmount VHD or VHDX File in Windows 10-diskpart_list_vdisk.png

    3 Do step 4 (disk #) or step 5 (path) for how you want to unmount the .vhd or .vhdx file.


    4 Use Disk # in PowerShell to Unmount VHD or VHDX file

    A) Type the command below into the elevated Windows PowerShell, press Enter, and go to step 6 below. (see screenshot below)

    Dismount-VHD -DiskNumber #

    Substitute # in the command above with actual disk number (ex: 2) from step 2 above.

    For example: Dismount-VHD -DiskNumber 2

    Mount or Unmount VHD or VHDX File in Windows 10-dismount-vhd_-disknumber_powershell.png


    5 Use File Path in PowerShell to Unmount VHD or VHDX file

    A) Type the command below into the elevated Windows PowerShell, press Enter, and go to step 6 below. (see screenshot below)

    Dismount-VHD -Path "Full path of .vhd or .vhdx file"

    Substitute Full path of .vhd or .vhdx file in the command above with actual full file path from step 2 above.

    For example: Dismount-VHD -Path "C:\Users\Brink\Desktop\Non-Insider W10.vhdx"

    Mount or Unmount VHD or VHDX File in Windows 10-dismount-vhd_-path_powershell.png


    6 You can now close Windows PowerShell if you like.






    OPTION NINE

    Unmount VHD or VHDX file in Command Prompt


    1 Open an elevated command prompt.

    2 Type diskpart into the elevated command prompt, and press Enter. (see screenshot below)

    3 Type list vdisk into the elevated command prompt, press Enter, and make note of the attached VHD or VHDX file path (ex: "D:\VHD\Example.vhdx") you want to unmount.

    4 Type the command below into the elevated command prompt, and press Enter.

    select vdisk file="Full path of .vhd or .vhdx file"

    Substitute Full path of .vhd or .vhdx file in the command with the actual full path of the .vhd or .vhdx file from step 3 you want to unmount.

    For example: select vdisk file="D:\VHD\Example.vhdx"


    5 Type detach vdisk into the elevated command prompt, and press Enter.

    6 You can now close the elevated command prompt if you like.

    Mount or Unmount VHD or VHDX File in Windows 10-unmount_vhd_command.png


    That's it,
    Shawn Brink






  1. Posts : 14
    Windows 10 Home 64-bit
       #1

    Mounted drive appears to be empty in File Manager


    Hi Brink. Thanks for your brilliant tutorials.
    I'm using W10 64-bit and its W7 Backup and Restore with an external 2TB hard drive for backup.
    With the aid of your tutorial I have mounted the .vhdx file for the C: drive system image as Drive M:, but when I try to view the contents of M: File Manager reports "This folder is empty". The image file size on the backup drive is 72.3 GB and the space used on virtual drive M: is only 9.7 MB of 17.9 MB capacity. The difference is suspiciously high to say the least. Both the real and the external hard drives are NTFS and 512 bytes per sector.

    I wonder if the problem could be related to VHD initialisation. I don't recall whether I chose MBR or GPT partition style, but I have a vague recollection of reading that GPT might be needed for UEFI. Would the wrong choice be accepted, and would it result in the above symptoms?

    Also, probably a minor point at present, but when I detach M:, either manually via Disk Management or by shutting down, the system seems to remember the attachment as M: and I no longer need to initialise. Does this mean I could run out of drive letters? Is there a way of completely removing this association? Do you mind if I suggest that this area be included in your tutorial if it has general relevance? My only other reference for this has been Windows 10 Inside Out, Bott, et al, Microsoft Press, 2015 - helpful as far as it goes.

    Thanks very much.
      My Computer


  2. Posts : 68,654
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    Hello Old Novice, and welcome to Ten Forums. :)

    Since this is a Windows Backup created from Windows 7, you might see if the method in the tutorial below may work for you instead to manually extract files from.

    Backup - Manually Extract Files from in Vista Windows 7 - Windows 7 Help Forums

    If this was a system image from Windows 7 instead, then see if this below may work better.

    System Image - Extract Files Using Disk Management - Windows 7 Help Forums
      My Computers


  3. Posts : 14
    Windows 10 Home 64-bit
       #3

    Hi, and thanks for your reply.

    There is no problem with File Backups. It is the System Image Backup .vhdx file which I am trying to view, using it to mount a VHD (Drive M:) which appears empty to File Manager. As you suggested I had a good look at the W7 tutorial for file mounting, and explored some of its links, but to no avail.

    I also tried to mount the VHD with Diskpart from elevated command prompt: Diskpart; select vdisk file=filename.vhdx; attach vdisk. There was no need to assign a drive letter as Windows remembered it, which is annoying. M: was again empty.

    Then, Windows PowerShell: Mount-VHD -Path "[location of vhd]". This cmdlet failed with error message "Mount-VHD is not recognised as the name of a cmdlet ...". Googling this, I found this could be due to the absence of a Hyper-V module for Windows PowerShell. Now, I know that Hyper-V Virtualization does not come with W10 Home but does with W10 Pro. Could my problem be related? Could it be that the image file is vdhx rather than vdh which I assume was the format in W7? I am out of my depth here, and don't want to experiment without advice.

    Out of interest I checked UEFI Bios and found Virtualisation Technology to be disabled, and Hyper-V missing from the Programs and Features list in Control Panel. With some trepidation I tried Enabling Virtualisation. Programs and Features list was unchanged, as was the PowerShell outcome and the zero content of M: after attaching via Disk Management. I returned Virtualisation to Disabled.

    Drive M:'s properties show its partition type to be GUID, not MBR.

    Grateful for any further thoughts. Thanks.
      My Computer


  4. Posts : 68,654
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #4

    Just to verify, are you sure that you are trying to mount the correct largest VHD from the system image?
      My Computers


  5. Posts : 14
    Windows 10 Home 64-bit
       #5

    Yes. There are three .vhdx files in the image backup folder:

    <GUID Filename.vhdx>: (C: Drive, I assume) 75,845,632 KB The one I've been using.
    <GUID Filename.vhdx>: (Windows Recovery, I assume) 526,336 KB
    Esp.vhdx: (EFI System Partition) 110,592 KB

    However, this morning I discovered some new information which I think might be helpful. My initial backup drive was a Seagate 2TB Expansion Drive in use for over a year, but never really tested except for checking the backup files were readable in File Manager, but not the image files. A couple of weeks ago I dropped this drive and Windows Backup would no longer accept it, and it didn't pass the Long Generic test by SeaTools for Windows, although chkdsk /scan reported no problems with the files or file structure, so I hope they might be recoverable. I replaced the drive with a Seagate 2 TB Backup Plus Slim which I first checked with chkdsk and Seatools for Windows. The above file sizes come from the new drive.

    This morning I tried to attach a VHD using the .vdhx file from the old drive, and it worked!

    While this might point to a fault in the new drive, I wonder if it matters that the old drive is 4096 bits/sector and the new drive 512. I think I recall reading somewhere that W7 would automatically change from .vhd files to .vhdx if the drive were 4096. Could there be some confusion in my machine due to this change affecting the Attach process?

    I hope this is not a red herring.
      My Computer


  6. Posts : 68,654
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #6

    Dropping the drive does indeed sound like the cause of a drive error affecting this.

    You might see if you are able to run Check Disk on the drive using the Repair drive option (if available) to see if that may help to with any bad sectors to hopefully be able to copy and read the .vhdx file from it afterwards.
      My Computers


  7. Posts : 14
    Windows 10 Home 64-bit
       #7

    Hi Brink
    Firstly, apologies that my last post was ambiguous. It was the old drive I had dropped that I was able to mount from and its replacement that I'm having trouble with.

    I did run chkdsk on both drives again, including the /f option on the new drive. Even though the dropped (old) drive is unaccepted by Windows Backup its existing files appear to be OK. So I succeeded in copying an old backup .vhdx file from the old drive to a new folder on the new drive. I could successfully mount the file from the old drive (to VHD N:), but not its copy from the new drive (to VHD M:); when trying to view M: from File Manager, I was still getting zero contents. It was while staring perplexedly at the Disk Management screen that I realised what was wrong, and I am very red-faced about it.

    In previous posts I mentioned that after initially assigning the drive letter M, future attempted attachments using the same file were automatically attached as M. I had just been accepting that, I guess without bothering to look carefully at the screen. It turned out that M had been assigned to the wrong VHD partition - the one at the right-hand side of the graphical display - and I had not picked it up. After correcting that everything works fine and I no longer have a problem. I also discovered that I can remove that ongoing association with the drive letter if, before detaching, I right click the (correct) VHD partition, choose the Change Drive Letter option and click Remove. I still think it would be helpful if you added a bit about this in this tutorial.

    So I do apologise for taking up your time; the upside of the exercise for me has been that I have learnt a lot and am now a member of 10 Forums.

    Regards and best wishes.
      My Computer


  8. Posts : 68,654
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #8

    That's great news Old Novice. I'm glad you got it sorted. :)

    No need to apologize. It happens to all of us.
      My Computers


  9. Posts : 6
    windows 10
       #9

    I just made a simple .bat in syst folder for fast mount but simpler than the exemple.
    Code:
    "c:\...\my.vhdx"
    Pause
    It doesn't work without pause
      My Computer


 

Tutorial Categories

Mount or Unmount VHD or VHDX File in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:52.
Find Us




Windows 10 Forums