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.
- Open Disk Management
- Now click on “More actions” and “Attach VHD”
- Now you can choose the VHD you want to attach
- As you can see you have now a new Virtual Hard Drive in your Disk Management
- To Detach the VHD right click on it and click on “Detach VHD”
You can also attach and detach VHD’s via 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
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.
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.
Hi :) Example for detach vhd file containt command attach ?!? Please correct… 10x and bye :)
Is there any case in which it will automatically detach? I’ve created and attached vhd’s as described but they always become ‘detached’