Sunday, 16 June 2013

Extending disks on a Windows VM

Extend disks on a Windows Server 2008 R2 machine (and probably Windows 7 as well).

Extend the hard drive in VM Settings, this can be done while Windows is running but I was unable to get Windows to see the new size until after I rebooted the VM.

GUI
Server manager->Storage->Disk management, right click on the drive and choose "Extend Volume..." select size to expand to then click next.

Command line way
Start->Run and type diskpart.
At the disk part prompt type:
DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           40 GB  5121 MB

This will show you a list of the disks in the system, once you have identified the disk you want by it's number (I only have disk 0 (zero) in the example above).
We now need the volume number:

DISKPART> list volume
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D   CD           CDFS   DVD-ROM      112 MB  Healthy    
  Volume 1         System Rese  NTFS   Partition    101 MB  Healthy    System
  Volume 2     C                NTFS   Partition     40 GB  Healthy    Boot
Now "select" the volume you want to extend (in this case I am extending my C drive so it is volume 2).

DISKPART> select volume 2

Volume 2 is the selected volume.

Now tell diskpart to extend the volume into the all the free space on disk 0:


DISKPART> extend disk=0

DiskPart successfully extended the volume.
That is it, all done.


Another easy way to extend disk sizes (as well as many other useful functions) is to run a live CD of gparted. This will also works with other operating systems such as Linux. In fact it should work any file system that gparted understands, check out there features page.

No comments:

Post a comment