Author: ZexksSubject: Vhd2disk
Posted: 02 February 2018 at 3:55pm
To all those who find this from google, and get the:
Can't write on physical drive. It's probably mounted.
You need to put it off line before to be able to write on it.
Microsoft choose this way for security reason...
It's nice for us and avoid to overwrite a non wanted drive.
Message. I think I have figured out how to get this working. First my setup.
Used Disk2VHD to (accidentally create a vhdx) backup a drive.
Used Powershell to convert the VHDX to a VHD, thanks to
this post.
From an elevated PS prompts:
Convert-VHD –Path c:\test\MY-VM.vhdx –DestinationPath c:\test\MY-NEW-VM.vhd
Next I hooked up my physical 500GB SSD to my physical disk 1 slot (this replaced my CDROM for this test)
In Windows (10 for me) use Disk Management to clear it off.
Remove all volumes.
Create 1 new volume
full size,
no drive letter,
don't format.
Right click on the disk and set it to offline.
Open an elevated CMD prompt. Type: diskpart
Hit enter, this will put you into another kind of prompt that should look like:
Microsoft DiskPart version ##.#.#####
Copyright (C) Microsoft Corporation
On computer: #ComputerName#
DISKPART> _
Now enter: list disk
You should see the target disk listed as offline
Now enter: select disk #NumberForDiskToWriteTo#
eg: select disk 1
Now enter: attributes disk clear readonly
It should report: Disk attributes cleared succesfully
Now try to run the VHD2Disk utility selecting your VHD file and the offline physical disk (disk 1 for me)
Click start ("Vhd to disk"), acknowledge the warning and you should be good to go now.
There may be a better way to check/set the readonly property on the drives that I wasn't able to find. It seems odd that the drive came in as readonly even through I had thoroughly wiped it, over and over and over again,....repeatedly wiped it. I would imagine these same steps should hold true back through windows XP as they all should have Disk Management and DiskPart but I can't guarantee it. If someone has a more user friendly way to handle that last part, as I couldn't find a way through Disk Management, it would be helpful if they posted it here for others in the future.