Compartir a través de


Increasing the size of a VHD

Q: Haileyesus asks, "How do you increase the size of a virtual hard disk?"

A: Unfortunately, Haileyesus, there's no way to increase the size of a virtual hard disk (VHD) once it's been created. VHDs are just like physical disks in this respect (and in most others, as well). If you need more space on your VHD, you'll need to create a new, larger .vhd file and then transfer your data to it. There are a couple of approaches you can take to transfer data, depending on whether the VHD contains a system partition. (Alternatively, you can attach an additional VHD to your virtual machine to add data storage capacity.)

1. If the VHD contains data with no operating system or installed applications, then you only need to copy the data to the new .vhd, as follows.

Method A

  1. Shut down any services that are using the data on the .vhd.
  2. Create a .vhd that is the the size you want.
  3. Add the .vhd to a virtual machine that is running a bootable operating system, so that you have file access to the .vhd.
  4. From within the guest operating system, format the .vhd using the same format as the original .vhd.
  5. Use a file copy tool like XCOPY or ROBOCOPY to copy the data to the .vhd with ACLs attached.
  6. Remove both the original and the new .vhds from their respective virtual machines.
  7. Add the new .vhd to the original virtual machine.

Method B

  1. Shut down any services that are using the data on the .vhd.
  2. Create a .vhd that is the size you want and in the same format.
  3. Add the .vhd to a virtual machine that is running a bootable operating system, so that you have file access to the .vhd.
  4. Use an imaging tool to image the original .vhd to a network location.
  5. Use the imaging tool to restore the image to the new .vhd.
  6. Remove both the original and the new .vhds from their respective virtual machines.
  7. Add the new .vhd to the original virtual machine.

2. If the VHD includes an operating system and/or installed applications, you'll need to to this:

  1. Create an image of the .vhd using a disk imaging tool (such as Ghost).
  2. Turn off the virtual machine and remove the .vhd that you just imaged. (Note that you will not be able to run a virtual machine with this .vhd attached at the same time as you run a virtual machine with the new .vhd attached. If you want to be able to do this, then you should SysPrep the .vhd before you image it. See my Sysprep article at https://blogs.technet.com/megand/articles/357570.aspx for more information.)
  3. Create a new .vhd file of the size you want and attach it to your virtual machine.
  4. Use the imaging tool to image the new .vhd.

Comments

  • Anonymous
    January 01, 2003
    Using Virtual PC for computer migration
    Tips for migrating a physical computer to a virtual machine:...

  • Anonymous
    January 01, 2003
    PingBack from http://maxfeed.ath.cx/item_1271203.html

  • Anonymous
    January 01, 2003
    I blog about Virtual Server a lot (as you may have noticed), but I'm not alone. Megan Davis is a...