Home » Hyper-V » Converting Fixed Size VHDs to Dynamic Sized VHDs

Converting Fixed Size VHDs to Dynamic Sized VHDs

If you value or enjoy this blog please feel free to donate. I receive no compensation for it and do not sell my endorsements.

Follow me on Twitter

Archives

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2,503 other followers

I was called in to help a company recently with a small Hyper-V environment.  They created a 2TB VHD file (they had good reasons for not using .vhdx files, but the steps in this article will work for both versions). 

They realized that they had unnecessarily created the drive as a 2TB Fixed Size disk rather than a Dynamically Expanding disk.  While there are no real performance differences between the two in Server 2012 R2, when it comes to portability, the dynamically expanding drives have a huge advantage.  When they realized that they were planning for a SAN upgrade, the IT Administrator decided to take the preemptive step of converting the disk.

It’s actually pretty easy… In the Hyper-V menu you click on Edit Disk…, and when the Edit Virtual Hard Disk Wizard comes up you go through the steps of selecting the appropriate file, and on the Choose Action screen select the radio button Convert.  On the next screen you specify the destination file, which eventually is where the problem is going to lie.  But for now you enter the filename, click Next, then click Finish to begin the process.

For those of you who are PowerShell fans, you can accomplish the same task by running the following cmdlet:

Convert-VHD D:\Hyper-V\HardDisk.vhdx -DestinationPath D:\Hyper-V\NewHardDisk.vhdx -VHDType Dynamic

Great.  Now you go into the settings of your virtual machine, point it to the new file, and boot it up.

Microsoft Emulated IDE Controller (Instance ID
{83F8638B-8DCA-4152-9EDA-2CA8B33039B4}): Failed to Power on with Error ‘General access denied error’
IDE/ATAPI Account does not have sufficient privilege to open attachment
‘D:\Hyper-V\NewHardDisk.vhd. Error: ‘General access denied error’
Account does not have sufficient privilege to open attachment
‘D:\Hyper-V\NewHardDisk.vhd. Error: ‘General access denied error’

Un-oh.  That doesn’t look good.  I click on the option to see the details, and it expands to the following:

‘VMName’ failed to start. (Virtual machine ID
1DC704C1-6075-4F6C-B364-AFE4947304F3)
‘VMName’ Microsoft Emulated IDE Controller (Instance ID
{83F8638B-8DCA-4152-9EDA-2CA8B33039B4}): Failed to Power on with Error ‘General access denied error’ (0x80070005). (Virtual machine ID
1DC704C1-6075-4F6C-B364-AFE4947304F3)
‘VMName’: IDE/ATAPI Account does not have sufficient privilege to open attachment D:\Hyper-V\NewHardDisk.vhd. Error: ‘General access denied error’ (0x80070005). (Virtual Machine ID 1DC704C1-6075-4F6C-B364-AFE4947304F3)
‘VMName’: Account does not have sufficient privilege to open attachment
D:\Hyper-V\NewHardDisk.vhd. Error: ‘General access denied error’ (0x80070005). (Virtual Machine ID 1DC704C1-6075-4F6C-B364-AFE4947304F3)

Alright, it looks like I have a file permission error.  When I look at the Security tab on the Properties window of the source VHD file I see the following:

image

Great… all I have to do is add that user (group?) to the new VHD file, and I’ll be set.  The problem is… how the heck do I do that?  I certainly can’t do it from the GUI… No problem. 

  1. Open a Command Prompt with Administrator credentials.
  2. type the following command: icacls “D:\Hyper-V\NewHardDisk.vhd” /grant “NT Virtual Machine\1DC704C1-6075-4F6C-B364-AFE4947304F3”:F
  3. The response should read:

processed file: D:\Hyper-V\NewHardDisk.vhd
Successfully processed 1 files; Failed processing 0 files
.

If this is what you got, then you are ready.  You should now be able to start up your virtual machine without error.

Good luck… now go forth and virtualize!

Advertisements

2 Comments

  1. Justin Coon says:

    Instead of the icacls step you could also run this in PowerShell after the Convert-VHD cmdlet:

    Get-Acl ‘D:\Hyper-V\HardDisk.vhdx’ | Set-Acl ‘D:\Hyper-V\NewHardDisk.vhdx’

  2. Noway Buddy says:

    Instead of using icacls simply drop the old disk from the hyper-v settings and add the new disk, the correct permissions are set upon adding a disk.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tweet Tweet…

Follow The World According to Mitch on WordPress.com
%d bloggers like this: