Mobile Log In
       Building and Delivering
Quality Software Results


Expanding Windows Server 2003 Virtual Hard Disk under Windows Server 2012 R2 Hyper-V

the Essence

This TechCrystal outlines the steps required for extending the C: drive of a Windows Server 2003 R2 virtual machine running under Windows Server 2012 R2 Hyper-V.  The technique works to expand the C: drive, the drive containing the OS and registry, if there is no D (or subsequent) drive space or partition on the disk of the virtual machine.

Here are the main components required:
  • a server running Windows 2012 R2 Hyper-V role
  • DISKPART.exe utility program, included in Windows Server 2012 R2

Why are we here?

Snug is the word for these digs
  • A virtual hard disk (a .vhd or .vhdx file) is running out of space or has grown to a point where there isn't enough space to install new programs, perform Windows Updates or write database records

  • You want to learn about new capabilities that are gained through the use of virtualization techniques.  For example:

  • by using this technique to expand the size of the C: drive, concerns for running out of space are reduced.  Therefore it is no longer necessary to consider allocating a maximum potential size (when setting the initial size of a new virtual machine C: drive).

  • you can toggle between fixed and dynamic sized disks (by changing settings (for the most part)).  Thus, it is easier to research whether fixed sized disks result in significantly better performance in your configuration (and are worth the additional overhead involved in storing and backing up (copying) the larger .vhd and .vhdx file sizes).  However, the steps to do this are no longer covered in this TechCrystal due to the differences in Hyper-V 2012 R2 (although easier) as opposed to Microsoft Virtual Server 2005, which is now obsolete.
A Little More Background

We are going to run the utility programs on a physical host machine running Windows Server 2012 R2 Standard x64 Edition SP2.

The guest OS installed on the .vhdx used in this example is Windows Server 2003 R2 Standard Edition SP2 (x86).

This technique is known to work using .vhd and .vhdx images holding machines running Windows 2003 R2 OS.  If you are running Windows Server 2012 R2 in the virtual machine, it will not be necessary to run the DISKPART utility from the command line in the physical host, you can do all you need to do to accomplish the expansion by changing the settings alone.







Steps to Extend and Expand Disk Capacity of a Windows Server 2003 R2 C: Drive Disk (in .vhdx format)



  • Please insure you have a reliable backup copy of the virtual machine before starting this process or any other involving significant changes to the virtual guest machine.   We'd also like to suggest that the virtual machine of our focus should be shut down, in order to avoid any physical resource allocation or other conflicts (as it will be in use when it is mounted later in this process).

  • Start up Hyper-V Manager on the physical host.  Shut down the virtual machine to be expanded.

    Go into Settings for the virtual machine. Select Hard Drive and click on Edit.



  • Select Expand.



  • Enter the new size and click Next.



  • Click on Finish.



  • Get to command entry on the physical host Windows Server 2012 R2

    Start the DISKPART utility.

    C:\Users\Administrator>diskpart

    Microsoft DiskPart version 6.3.9600

    Copyright (C) 1999-2013 Microsoft Corporation. On computer: YOURSERVERNAME

    DISKPART>

  • Run select vdisk, where

    D:\Hyper-V\Virtual Hard Disks\vwhv2003c.vhdx is the path and file of the virtual disk to be mounted


    DISKPART> select vdisk file="D:\Hyper-V\Virtual Hard Disks\vwhv2003c.vhdx"

    DiskPart successfully selected the virtual disk file.


  • Run the next 6 commands in order to mount and extend the virtual hard drive.


    DISKPART> list vdisk

      VDisk ###  Disk ###  State                 Type       File
      ---------  --------  --------------------  ---------  ----
    * VDisk 0    Disk ---  Added                 Unknown     D:\Hyper-V\Virtual Hard Disks\vwhv2003c.vhdx


    DISKPART> attach vdisk

      100 percent completed

    DiskPart successfully attached the virtual disk file.


    An additional disk drive will now show under My Computer (shown as drive F below).




    DISKPART> list vdisk

      VDisk ###  Disk ###  State                 Type       File
      ---------  --------  --------------------  ---------  ----
    * VDisk 0    Disk 1    Attached not open     Expandable  D:\Hyper-V\Virtual Hard Disks\vwhv2003c.vhdx



    DISKPART> list disk

      Disk ###  Status         Size     Free     Dyn  Gpt
      --------  -------------  -------  -------  ---  ---
      Disk 0    Online          952 GB      0 B
    * Disk 1    Online           44 GB  5120 MB



    DISKPART> list volume

      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 0     E                       DVD-ROM         0 B  No Media
      Volume 1         System Rese  NTFS   Partition    350 MB  Healthy    System
      Volume 2     C                NTFS   Partition    124 GB  Healthy    Boot
      Volume 3     D                NTFS   Partition    827 GB  Healthy
      Volume 4     F                NTFS   Partition     38 GB  Healthy



    DISKPART> select volume 4
    Volume 4 is the selected volume.

    Note that the vdisk volume to use is the last one.


    DISKPART> extend

    DiskPart successfully extended the volume.


    DISKPART> list volume

      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 0     E                       DVD-ROM         0 B  No Media
      Volume 1         System Rese  NTFS   Partition    350 MB  Healthy    System
      Volume 2     C                NTFS   Partition    124 GB  Healthy    Boot
      Volume 3     D                NTFS   Partition    827 GB  Healthy
    * Volume 4     F                NTFS   Partition     43 GB  Healthy



    DISKPART> detach vdisk

    DiskPart successfully detached the virtual disk file.


    DISKPART> exit

    Leaving DiskPart...

    C:\Users\Administrator> exit


End of Steps to Expand Windows Server 2003 Disk Capacity
  • In most cases it will make sense to create a new backup copy before going live and into production mode.

    Start up the virtual machine.
    You have succeeded!



        go to the home page Top of Tech Crystals     go to next series page     Site Map     Mobile View
You are at the web site of Tegratecs Development Corp.  Click here to go to the home page of this site...
Integrity, Integration and ROI
Our contact information:
Tegratecs Development Corp.
1320 Tower Road
Schaumburg, IL 60173
847-397-0088
( please register or sign-in )
© 2017 Tegratecs Development Corp.