Jul3

Written by:David Aldridge
7/3/2014 2:46 PM 

I had an older VM that I was running out of space in the main system partition.  I needed to extend the size of the VHD and then extend the size of the system partition.  This ended up being a two step process.

Shut down the VPC and copy the VHD file to a Windows 7/2008 R2 or later machine.

Here open up a command prompt and type the following:

select vdisk file="path\to\file"
expand vdisk maximum=16384

Replacing path\to\file with the appropriate path to the VHD file and maximum=16384 with the new maximum size you want it to be in MB.

Exit from diskpart and the VHD files maximum size will have been expanded.

If you only have one partition on the disk then you can open it back up in diskpart and extend the partition:

select vdisk file="path\to\file"
attach vdisk
list volume
select volume=<vol no>
extend

This will extend it to the new size.  You can use 'extend size=x' to extend it by x MB instead of taking the whole extension.

If you have multiple partitions on the disk this will only work for the last partition on the disk.

This was my case.  I downloaded SysRescueCD (sysresccd.org), and booted into that in a virtual with the disk attached.  I then used gparted to move and resize the partitions in the vhd.
This worked, but all of the partitions except for C: had their drive letter changed and once I booted back into the real VM I had to reassign the correct original drive letters.
 

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment  Cancel 
You must be logged in and have permission to create or edit a blog.