Windows Server 2012 R2 and Hyper-V provide several ways for administrators to manage and manipulate VHD images without mounting them in a VM. Once you have created a VHD, whether you have attached it to a VM or not, you can manage it by using the Edit Virtual Hard Disk Wizard in Hyper-V Manager. To edit an existing VHD or VHDX file, use the following procedure.
1. In Server Manager, on the Tools menu, select Hyper-V Manager to open the Hyper-V Manager console.
2. In the left pane, select a Hyper-V server.
3. In the Actions pane, select Edit Disk. The Edit Virtual Hard Disk Wizard starts, displaying the Before You Begin page.
4. Click Next to open the Locate Disk page.
5. Type or browse to the name of the VHD or VHDX file you want to open and click Next.
The Choose Action page appears.
6. Select one of the following functions:
– Compact Reduces the size of a dynamically expanding or differencing disk by deleting empty space while leaving the disk’s capacity unchanged.
– Convert Changes the type of format of a disk by copying the data to a new disk image file.
– Expand Increases the capacity of the disk by adding empty storage space to the image file.
– Shrink Reduces the capacity of the disk by deleting empty storage space from the file.
– Merge Combines the data on a differencing disk with that of the parent disk to form a single composite image file.
7. Click Next to open the Completing The Edit Virtual Hard Disk Wizard page.
8. Complete any new pages presented by the wizard as a result of your selection and click Finish.
The options that appear on the wizard’s Choose Action page depend on the current status of the image file you select. For example, the Merge option only appears if you choose a differencing disk, and the Shrink option does not appear unless there is free space in the file that the wizard can delete.
In addition to these disk-editing functions provided by Hyper-V Manager, it is possible to use the Disk Management snap-in on the Hyper-V host to mount a VHD or VHDX file as a drive and access its contents, just as if it were a physical disk.
To mount a VHD file, use the following procedure.
1. In Server Manager, on the Tools menu, select Computer Management to open the Computer Management console.
2. In the left pane, select Disk Management. The Disk Management snap-in opens.
3. From the Action menu, select Attach VHD. The Attach Virtual Hard Disk dialog box appears.
4. In the Location text box, type or browse to the image disk file you want to attach and click OK. The disk appears in the Disk Management interface.
5. Close the Computer Management console.
At this point, you can work with the virtual disk and its contents using any standard tools, just as you would a physical hard disk drive. To detach the VHD, you use the same procedure and select Detach VHD from the Action menu.
This article is a part of 70-410 Installing and Configuring Windows Server 2012 Prep course, more articles in this course are :
70-410 Installing and Configuring Windows Server 2012 Prep course includes following practice tests: