PrepAway - Latest Free Exam Questions & Answers

Which powershellcmdlet option you should run first?

You run a Windows 2012 Hyper-V Role Server, you need to shrink the size of files.vhd. Which
powershellcmdlet option you should run first?

PrepAway - Latest Free Exam Questions & Answers

A.
Dismount-VHD

B.
Mount-VHD

C.
Resize-VHD

D.
Convert-VHD

Explanation:
Convert-VHD – Converts the format, version type, and block size of a virtual hard disk file. Convert-VHD Path c:
\test\files.vhd DestinationPath c:\test\testvhdx.vhdx The Resize-VHD cmdlet resizes a virtual hard disk. This
cmdlet lets you shrink or expand the size of a virtualhard disk, but the shrink operation is allowed only on VHDX
virtual hard disks. The shrink operation fails ifitwould shrink the virtual disk to less than its minimum size
(available through the VHDX object’s MinimumSizeproperty). After converting a dynamically expanding VHD to
the VHDX format, a new Shrink menu option becomesavailable in the Hyper-V UI as shown. VHDX format
VHDs only expose the Shrink option when there is free space in the VHDX file to reclaim.

http://technet.microsoft.com/en-us/library/hh848454.aspx http://blogs.msdn.com/b/virtual_pc_guy/
archive/2012/05/10/shrinking-a-vhd-in-windows-8- fast.aspx
http://technet.microsoft.com/en-us/library/hh848535.aspx

24 Comments on “Which powershellcmdlet option you should run first?

  1. TestUser says:

    I still think this is Convert-VHD. You can only see the shrink option from Resize-VHD after it is a VHDX (meaning you need to convert to VHDX first.)

    “The Convert-VHD cmdlet converts a virtual hard disk file by copying the data from a source virtual hard disk file to a new virtual hard disk file of a specified format and version type. The format is determined by the file extension of the specified files, either .vhdx or .vhd. Conversion is an offline operation; the virtual hard disk must not be attached when the operation is started.”

    http://technet.microsoft.com/en-us/library/hh848454.aspx

    Anyone else agree/disagree?




    1



    0
  2. Imi says:

    I think the correct answer is D. Convert.

    To resize a vhd, you have to unmount it first, and then convert it to vhdx.
    The other 2 option mount and dismount cmdlets lets you to mount&unmount virtual disks to&from HYPER-V HOST, so no effect on virtual machines. The last option is D.




    0



    0
  3. Fausto says:

    If you read the question, you have a Hyper-V 2012 Server and a file named file.vhd. There is nothing that says that filed.vhd is attached to any VM. So I can only assume that this is a virtual hard disk by itself. So since it is not mounted, you can run the resize-vhd after reading your posts.
    Now I went through this exercise with a live server. What I didn’t know was that I needed to shut it down, dismount the VHD, then run the offline resize. What I have done is exactly what TestUser explained.
    These questions can be very tricky depending on how you approach them. If you don’t jump too quickly to conclusion and read the question asked, you will realize that the answer is quite easy. Here I will have to go with C (Resize-vhd). By any means, go through the exercise and test it yourself. I don’t have my lab with me today but I will definitely test this out.




    0



    0
  4. Fausto says:

    Ok folks,
    I had a chance to test this out in my Hyper-V 2012 Lab. The option to shrink a storage is only available in 2012R2 not 2012. I was not able to shrink the files.vhd I created using Resize-VHD, the only thing I was able to do with this command was to expand but not shrink. So for this question, it is clear you need to convert to vhdx first. Only then you need 2012R2 to shrink the vhdx. I have to change my previous result.
    The answer for this question is D as explained by TestUser. There is another similar question like this earlier 93. Review it and you will see my current conclusion is the same result there.
    Answer: D




    0



    0
  5. Fausto says:

    This question was bothering me a bit. So I took another spin to it. I need to correct my assertion that shrink storage is not available until 2012R2. In fact, what I meant to say was live shrinking storage is not available until 2012R2 and the storage has to be vhdx format attached at SCSI disk. That’s just on the side note.
    Now I read the question again and I did exactly that:
    1. I created two files file1.vhd and file.vhdx both with size 127GB
    2. I mounted formatted the drives within the OS using disk management for 127GB
    3. I dismounted them and opened edit disk within Hyper-V manager and click on edit. There was not shrink option available for both files
    4. I mounted both disk back to the disk management on the Hyper-V server and shring the space allocated by 100GB leaving each disk with 27GB. At this point, there was space behind the disk as all 127GB were no longer fully allocated.
    5. I dismounted the disks because I couldn’t complete any edits while they were mounted
    6. I ran edit disk from Hyper-V manager, there was an option to shrink disk file1.vhdx but no option to shrink file.vhd. So I was able to successfully shrink the .vhdx file.

    Now for good, here is the sequence is reducing a .vhd:
    1. Convert the file to .vhdx
    2. mount the vhdx file.
    a. if the disk is already formatted, shrink it to the newly desire size
    b. if the disk is not formatted, format it with NTFS with the desire space leaving empty space you want to remove from the disk
    3. dismount the .vhdx file and run edit from Hyper-V pointing to the .vhdx file
    4. Chose the shrink option which will reduce the entire size of the .vhdx to its current allocated removing the empty space.

    It is important to note that you will not be able to shrink a disk even a .vhdx if its entire space has been allocated within the OS. You only will be able to shrink empty space not used on the disk. With that said, if you want to reduce the size of the 200GB fully allocated .vhd, you will first need to convert the disk to .vhdx, shrink to allocated space on the volume within the OS. After that is completed, dismount it and shrink the disk space from Hyper-V edit disk option.

    I hope this helps everyone for these types of questions.

    Regards




    0



    0
  6. semevalavida says:

    The Resize-VHD cmdlet resizes a virtual hard disk. This cmdlet lets you shrink or expand the size of a virtual hard disk, but the shrink operation is allowed only on VHDX virtual hard disks. The shrink operation fails if it would shrink the virtual disk to less than its minimum size (available through the VHDX object’s MinimumSize property).

    Resize-VHD is an offline operation; the virtual hard disk must not be attached when the operation is initiated.




    0



    0
  7. dave says:

    I would agree with Converting:

    https://technet.microsoft.com/en-us/library/hh848535(v=wps.630).aspx

    The Resize-VHD cmdlet resizes a virtual hard disk. This cmdlet lets you shrink or expand the size of a virtual hard disk,

    **but the shrink operation is allowed only on VHDX virtual hard disks.**

    The shrink operation fails if it would shrink the virtual disk to less than its minimum size (available through the VHDX object’s MinimumSize property).




    0



    0

Leave a Reply