Question

Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd) that is only sized at 8.2 GB. I would like to double the size to something like 16-20GB. I see options for compacting the VHD but nothing to expand it. It's set to "dynamically expand" but I'm installing some software and it doesn't seem to resize itself to a larger space.

Thanks much.

Was it helpful?

Solution

OTHER TIPS

Heres my solution, using VHDResizer and DISKPART on a Windows XP host.

  1. Download VHDResizer from here
  2. Following these instructions from "Murnic" on this thread didnt work, on entering EXTEND, not sure on the exact wording now, but it was along the lines of cant extend this volume.

The easiest way to do this (as long as you have enough hard drive space) is to extend your existing VHD using VHD Expander which gives you two VHD files. The newly extended file will take the name of your existing VHD. You might want to Defragment, Precompact, and Compact your VHD prior to extending your VHD.

In Virtual PC 2007 go to Settings.

  • Select your OLD VHD as Hard Disk 1
  • Select your newly extended VHD as Hard Disk 2
  • Boot your VM
  • Open an Command Prompt
  • Run diskpart
  • From DISKPART> - Execute LIST VOLUME - Select your new VHD volume by executing SELECT VOLUME where is your new VHD most likely 2 - Execute EXTEND - You should see a success message. If not you may have to recreate your extended VHD due to an error in the process.
  • Quit Diskpart.exe by typing EXIT
  • Shut Down the VM
  • Remove both VHD files from the Hard Disks list
  • Add your newly extended VHD as Hard Disk 1
  • Boot your VM.
  • You will get a Windows Newly Added Hardware message after a short time.
  • Reboot the VM when prompted
  • Start using your newly extended VHD!

Here is Microsoft's information on extending volumes using Diskpart.exe: http://support.microsoft.com/kb/325590

So I went back to these instructions from 'AutoSponge' at the start of the same thread,

Mount the image

  1. C:>Program Files\Microsoft Virtual Server\Vhdmount>vhdmount /m “C:Documents and Settings\All Users\Documents\Shared Virtual Machines\.vhd”
  2. Start diskpart and expand the partition

    C:>Program Files\Microsoft Virtual Server\Vhdmount>diskpart

    DISKPART>list disk

    DISKPART>select disk 3 -----check the number in the list

    DISKPART>list part

    DISKPART>select part 1 -----check the number in the list

    DISKPART>extend DISKPART>list part -----check the new size

    DISKPART>exit

  3. Dismount and save changes

    C:>Program Files\Microsoft Virtual Server\Vhdmount>vhdmount /u /c “C:Documents and Settings\All Users\Documents\Shared Virtual Machines\.vhd”

You can get download Microsoft Virtual Server here. You can do a custom install and only select VHDMount

Some more information using VHDMount

Using VHDMount with Windows XP -

It is not possible to use '/m' (Mount), you can only use '/p' (Plug in).

The reason for this is that VHDMount uses VDS (the Virtual Disk Service) to assign a disk letter to the virtual hard disk after it is mounted, but VDS is only included in Windows Server 2003 and later. This is not too big of an issue though, as unlike Windows Server 2003, Windows XP will automatically mount the virtual hard disk when it is plugged in. This means that the only functionality you lose on Windows XP is the ability to specify exactly which drive letter should be used.

Never worked with Virtual PC but from other virtualization software I know I guess that dynamically expand means that initially the .vhd file will take less space in the HD than the specified and will dynamically grow as you keep installing programs or adding files into the virtual drive UP TO the specified size.

For what you want I guess that you will have to modify the specified size in the virtual hard drive from Virtual PC's setup window.

A bit offtopic but give a go to Virtual Box: www.virtualbox.org

For vmware users, you can download a free edition of vmware converter which not only lets you resize virtual disks but also lets you convert from physical to virtual machines and vice-versa.

Here is a solution that worked for me: Use "CopyWipe" or a similar software to make a hardcopy to a new vhd, as described here:

Eric Cosky

I found it easier, simpler and safer to just create a second VHD and install my Big Software to that HD.

First detach the VHD then run those commands to expand your disk:

  1. diskpart
  2. Select vdisk file="Your Path"
  3. list vdisk
  4. expand vdisk maximum=new size in MB
  5. attach vdisk
  6. list disk
  7. online Disk
  8. list volume
  9. select volume #
  10. extend
  11. list Volume
  12. detach vdisk
  13. exit

And here's a brief description for what each line does:

  1. Launch the DiskPart utity.
  2. Select the VHD file. Notice that if the path or the file name has spaces you have to put double quotes around it.
  3. Shows you a list of Vdisks. The * at the left shows the one that is selected.
  4. Changes the size of the vdisk to our new size.
  5. Once the disk is expanded you have to mount it to work on the disk.
  6. Shows the list of disks mounted disks and vDisks including ours.
  7. If disk is not showing online you will need to bring it online.
  8. List volumes(partitions). The ### column is the most important since it has the number you need to use to select the volume you will work with.
  9. Select the volume we want to work with.
  10. Extends the currently selected volume to use all contiguous available space on the same disk.
  11. Running again to show the new size.
  12. Dismounts the Vdisk volume so that Hyper-V can load it.
  13. Exit diskpart utity.

However I give no guarantee this will work for everyone so keep the original around until you complete the process, just in case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top