We’re starting some SharePoint development and I needed to create a development environment on Windows Server 2003. So I created a new virtual machine (VM) of Server 2003 on our VMware ESX box and gave it a 1GB of RAM and 8GB of disk space. I installed the OS and configured it for Windows SharePoint Services (WSS) and then installed Visual Studio 2008. That left us with about 1.5GB of disk space. Oops, time to resize the drive.
The beauty of working with virtual machines is that it’s relatively easy to increase or decrease the memory and disk storage. In this case, I wanted to add another 4GB to the virtual disk. I powered down the virtual machine and went into the “Virtual Machine Properties” from the VMware Infrastructure Client (VIC). I selected the hard drive and it provided a entry field for the new size. I increased the size to 12GB, adding an additional 4GB.
That takes us part way there. I increased the size if the virtual disk from 8GB to 12GB, but it still has an 8GB partition, the OS wont see the additional space. I saw all some tips on that Series of Tubes that recommended downloading Linux boot disks and boot the the VM from the Linux CD images as an .ISO file.
Meh, that’s too much work. I took a simpler path. I powered down another Server 2003 VM that was already running on the ESX box and added new VM’s virtual disk as a second virtual drive. I booted up the second VM and opened up a command shell. From the command shell, I ran the diskpart utility to extend the partition. I did the following commands through diskpart:
Microsoft DiskPart version 5.1.3565
Copyright (C) 1999-2003 Microsoft Corporation.
On computer: XXXXX
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 E DVD-ROM 0 B
Volume 1 C NTFS Partition 12 GB Healthy Boot
Volume 2 D NTFS Partition 8 GB Healthy
DISKPART> select volume 2
Volume 2 is the selected volume.
I basically typed that in from memory, some of the numbers may be off, but it shows how to extend the size of the partition. After exiting out of diskpart, I then shut down the second VM. Next, I removed the virtual drive that belongs to the new VM. Remember to select remove only and not remove and delete. At this point I was able to power both VM’s back up. The second VM will be slightly confused about the missing drive, but it was back to normal. The new VM took some time to check out the resized partition after I logged back in. With my VM, it declared it to be new hardware and wanted to reboot. After it rebooted, it was happy and recognized that it had a 12GB partition.