Image may be NSFW.
Clik here to view.
In this post I will look Inspecting and Editing virtual disks in Hyper-V. In a previous post I looked at creating a vm template to deploy virtual machines from. The template used a Dynamically expanding virtual hard disk, so although the virtual machines’s operating system would see it as 127GB it’s actual size at deployment was 18GB, and it will grow as required up to its specified maximum size.
This is great for keeping storage usage down while testing or for templates storage, but in a production envrionment it is best practice to deploy fixed disks to increase disk throughput.
From within Hyper-V Manager you can select Inspect Disk whether the virtual machine in question is turned on or off.
Select Inspect Disk from the Actions menu, browse to the disk you want to inspect, in this example I will look at Phoenix’s virtual hard disk.
Image may be NSFW.
Clik here to view.
As you can see the Phoenix is currently using a Dyanmically expanding virtual hard disk with a maximum size of 127GB, and currently is 17.63GB in size.
Image may be NSFW.
Clik here to view.
Now before we deploy Phoenix into production I want to change the disk type from Dynamically expanding to Fixed. To do this you have to shut the virtual machine down. If you edit the disk while it is running you only have the Compact or Expand options available to you (See below).
Image may be NSFW.
Clik here to view.
In Hyper-V Manager with Phoenix shutdown select Edit Disk. (You can also perform the following steps from within the settings of the virtual machine, which saves a couple of clicks as the virtual hard disk in question is already selected in the Edit disk wizard).
Image may be NSFW.
Clik here to view.
Click Next on the Before you Begin page.
Image may be NSFW.
Clik here to view.
Click Browse, and locate the virtual hard disk file, then click Next.
Image may be NSFW.
Clik here to view.
Now that the virtual hard disk file is not in use you have a new option to Convert it. Select the Convert radio button, this gives you three more steps in the Wizard. Click Next.
Image may be NSFW.
Clik here to view.
Choose the Disk Format, in this example I’m working in a pure 2012 R2 environment so I will select the VHDX radio button, and click Next.
Image may be NSFW.
Clik here to view.
Select the Fixed size radio button, because this virtual machine is going to go into production, click Next.
Image may be NSFW.
Clik here to view.Choose a name and location for the fixed disk, the wizard will convert the selected disk to a new file, so I have choosen to save it to the D:Temp folder and called it the same name as the original disk. Click Next.
Image may be NSFW.
Clik here to view.
Read through the Summary and click Finish to start the process.
Image may be NSFW.
Clik here to view.
Converting this disk took approximately three minutes on a server with out of hours iops, obviously the time it will take will depend on your storage infrastructure.
Image may be NSFW.
Clik here to view.
Browse to D:Hyper-VVirtual Hard Disks and rename the original Phoenix.vhdx file to Phoenix-original-dynamic.vhdx. Now browse to D:Temp and copy the new fixed disk Phoenix.vhdx to D:Hyper-VVirtual Hard Disks. The image below shows the original and the new disk highlighted, notice the difference in size.
Image may be NSFW.
Clik here to view.
Now although we have renamed the new Fixed disk to be the same as the original Dynamic disk, we need to go into the VM Settings and remove the original disk and add the new disk so it has the correct permissions. If you compare the two disks permissions at this stage you will notice they are different.
Right click Phoenix, select Settings, highlight the Hard Drive, and click Remove, then click Apply.
Image may be NSFW.
Clik here to view.
Now highlight Hard Drive and click Add, click Browse and select Phoenix.vhdx, click Open and finally click Apply then OK.
You can now power on the virtual machine Phoenix with its new fixed disk.
Inspecting the disk shows it is fixed and takes up the full 127GB of disk space. Image may be NSFW.
Clik here to view.
Related Posts:
1. How to create a Hyper-V VM template without VMM
2. How to convert a Hyper-V VHDX to VMDK for VMware Workstation
3. Windows update fails on Hyper-V 2012 R2 generation 2 virtual machines
4. Windows Server 2012 Hyper-V Best Practices
5. How to enable Data Deduplication in Windows 2012
The post How to Inspect and Edit virtual disks in Hyper-V appeared first on Oxford SBS Guy.