VHD for Hyper-V Guest on Server 2012 R2

Hi there

I have a guest Windows 2008 R2 machine on a Windows 2012 R2 Hyper-V host. It had some problems booting up so I removed the VHD and now trying to add the same VHD again. The VHD sits on a SAN and I've used iSCSI Initiator on the Windows 2012 R2 Server to connect to the target disk. I can connect to the disk and can browse the disk plus also copy all contents to another disk.

But when I try to add the VHD which is located on this iSCSI Target Disk to a Hyper-V guest, I get an error message:

"Error applying Hard Drive changes. XXXX failed to modify device Virtual Hard Disk (Virtual machine ID 81E9D60A-......)

Failed to open attachment "D:\Hyper-V\XXXX.vhdx". Error: The media is wrtie protected.

Any idea why this is happening when I have full Read & Write access to then iSCSI Disk?

February 20th, 2015 7:03am

You said that you connected to this VHD using the iSCSI initiator.

I am assuming that the iSCSI initiator is no longer configured to 'own' this VHD.  Thus allowing your Hyper-V Server to 'own' it.

And, I am not fully grasping your configuration.

Free Windows Admin Tool Kit Click here and download it now
February 20th, 2015 7:34pm

I see where you said that you tested by copying contents OFF of this SAN volume, but nothing where you tried copying contents TO this SAN volume. Some methods of mounting remote volumes in Windows default to the volume being set in a read only state.

On the Hyper-V host, run this in an elevated PowerShell prompt:

Get-Disk | ? { $_.IsReadonly }

If it finds anything, you can do this:

Get-Disk | ? { $_.IsReadonly } | Set-Disk -IsReadOnly $false

If you have more than one found and don't want to change them all, then this works just as well (use the disk number from the first column of the Get-Disk cmdlet):

Set-Disk -Number 42 -IsOffline $false
If this disk is owned by a cluster, then these steps aren't going to work.

February 20th, 2015 9:59pm

Thanks. As a matter of fact, the Disk was Read-Only. This I didn't know untill I checked out Disk Management after reading your comments. All I had to do was take the Disk Offline from Disk Management and put it back Online.

Cheers.

Free Windows Admin Tool Kit Click here and download it now
February 21st, 2015 11:47pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics