I have an XP machine, with a 60GB Drive size. In the interests of resilience, I created a clone of this drive, onto a 1TB disk. I want to try avoid using disk2vhd on the origianl disk if possible.

From this cloned disk I created a .VHD file using "Disk2VHD".

I am trying to run this VHD as a VM, (which must be hosted on a local machine), but VM software allows VM's of upto 127GB.

I have attached my VHD in disk management, and am looking for a way I can truncate the disk down to 90GB. (50GB used, 850GB unallocated.) Essentially I want to get rid of the unallocated volume that resides on the disk.

Is there a way / piece of software, that can do this?

  • So you cloned the XP machines disk to a 1 TB disk (so it had 1 partition of 60 GB and ~840 GB unused) and ran Disk2VHD on that? Now you got a 1 TB VHD you want to shrink to 90 GB? – Seth Oct 20 '17 at 10:50
  • Yup, there was very little time for planning the cloning of the machines, lets say, thus 1TB was used across all Pc's hence the disparity. – Thom G Oct 20 '17 at 11:04
  • What did you try to resize the VHD so far? After all cmdlets like Resize-VHD should be an easy find? – Seth Oct 20 '17 at 11:08
  • @Seth, I haven't been able to fine any resource that allows me to do what I want, the resource you pointed me to can't do what I need: "... but the shrink operation is allowed only on VHDX virtual hard disks." – Thom G Oct 20 '17 at 11:36

Short anwser is you cant. You can however create a backup of all allocated sectors and copy them to a new vdisk. Within Hyperv manager you can select Edit Virtual disk and one of the options is to convert VHD to VHDX. This will do as I described but will be very slow and copy the entire disk.

Once you have a vhdx you can shrink it but only to the last used sector. To get it smaller you also need to shrink the file system.

  • @Ramhound Because he's trying to shrink a VHD, not a VHDX. "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." – Skrymsli Sep 6 '19 at 15:27
  • 1
    @Skrymsli - It took 2 and half years for somebody to answer my commnet. I missed that particular sentence in the documentation. – Ramhound Sep 6 '19 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.