This week I was looking at the new functionality of WinPE 2.0, one very interresting tool is the new version the diskpart utility.
There are some really cool new features, one of them is that you can format a drive from within diskpart (saves you another few lines in your scripts) but the coolest feature is that you can now extend and shrink all partitions even boot or system partitions.
Previously when you wanted to extend or shrink a boot volume, you had to create a new disk with the proper size, xcopy the content and replace the original disk with the new disk of your VM. While I guess everybody played with the extend option I won't cover that, but the shrink option is completely new.
When you want to shrink you have to use the shrink option with caution:
1. Power off your Virtual Machine
2. Boot-up your virtual machine with winPE 2.0
3. Type: diskpart at the command prompt
a. Type: select volume
b. Type: shrink querymax
This will output the maximum reclaimable bytes.
c. Type: shrink desired=xxx (where xxx are the number of MB,
you want to reduce your volume by.
This cannot be larger the output of the previous command.
This will shrink your volume.
d. Confirm the result by typing: list volume
Your volume should now show the shrinked size,
remember the size as you need to provide it when shrinking
the actual vmdk file using the vmkfstools.
e. Type: Exit
4. Type: exit to reboot winPE
5. Power off the virtual machine
6. Shrink your vmdk file using vmfstools -x xxxxM my.vmdk --force
(where xxxx is the output of 3d)
7. Power on your virtual machine..