I have a Windows Server 2008 R2 with Hyper V installed.
One of the virtual machines is a 150GB dynamically expanding virtual hard disk (Windows). I would like to shrink this to 100GB, however I can't seem to achieve this.
What I have tried so far;
- opened disk management on guest machine and shrunk the HDD by 50GB, this is now displaying as 'unallocated' in the guest.
- ensured there are no snapshots of the guest OS
- defragmented the guest machine
- selected the guest machine in Hyper V and ran 'compact'
However whenever I inspect the disk in Hyper V it's still showing as 150GB, there's no change.
I have also tried the diskpart
tool, using the following commands on the guest OS however same result;
select vdisk File=”I:\path\to\your.vhd”
attach vdisk readonly
compact vdisk
detach vdisk
Am I missing something?
Few questions;
I've read that it's not possible to shrink dynamically expanding virtual hard disks- is this true? If I simply delete the VM in Hyper V, where will the 150GB be reallocated to?
I'm unable to export the VM and create a new one as my host machine is very low on space.