, ,

Howto Attach / Detach VHD in Windows Server 2008 R2

This little HowTo shows you how you can attach or detach VHDs (Virtual Hard Disk) in Windows Server 2008 R2 or Windows 7. Basically you can use the Disk Management in the Server Manager to do that.

  1. Open Disk Management
    Disk Management Windows Server 2008 R2
  2. Now click on “More actions” and “Attach VHD”
    Disk Management Windows Server 2008 R2
  3. Now you can choose the VHD you want to attach
    Attach VHD
  4. As you can see you have now a new Virtual Hard Drive in your Disk Management
    Attach VHD Windows Server 2008 R2
  5. To Detach the VHD right click on it and click on “Detach VHD”
    Detach VHD Windows Server 2008 R2

You can also attach and detach VHD’s via diskpart.exe

Attach VHD with Diskpart.exe

Attach VHD via Diskpart.exe

diskpart
select vdisk file="D:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\data.vhd"
attach vdisk

Detach VHD via Diskpart.exe

diskpart
select vdisk file="D:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\data.vhd"
attach vdisk

4 responses

  1. Faye Jasman Avatar
    Faye Jasman

    Thanks for the command line instructions they have saved me lots of frustration. For whatever reason can’t do it via the managment console. I noticed though that at leave for me, when detaching the .vhd, I had to use the command – detach vdisk.

  2. Jimf Avatar

    My problem is the “create/mound vhd” menu items are not present at all. (Not even grayed) Running Windows Server 2008 SP2. I’ve been searching for a solution, went to Programs -> add windows feature and didn’t see anything there to add the feature.

  3. neko Avatar

    Hi :) Example for detach vhd file containt command attach ?!? Please correct… 10x and bye :)

  4. Chip Avatar

    Is there any case in which it will automatically detach? I’ve created and attached vhd’s as described but they always become ‘detached’

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.