Resize the VHDX file

The following process changes the VHD file size using the power shell (run as administrator).
  1. mount-vhd –passthru | get-disk | get-partition | get-volume
    • This will mount the virtual hard disk in the management operating system, and let you know the drive letter that was assigned to it.
    • Ex: mount-vhd F:\MYVHD.vhdx –passthru | get-disk | get-partition | get-volume
  2. resize-partition –driveletter –size
    • This will resize the partition inside the virtual hard disk.
    • Ex: resize-partition –driveletter I –size 60GB
  3. dismount-vhd
    • Dismount the virtual hard disk after shrinking the partition.
    • EX: dismount-vhd F:\MYVHD.vhdx
  4. resize-vhd –ToMinimumSize
    • Now shrink the virtual hard disk to match the new size
    • EX: resize-vhd F:\MYVHD.vhdx –ToMinimumSize
Advertisements
This entry was posted in Windows. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s