VMware Cloud Community
Ardenvel
Contributor
Contributor

Increasing C Drive On Virtual Server

Hi, new member !

We run multiple virtual servers on various ESX hosts, all connected to different LUNs on the same SAN. We use standard images to build each image and the C drive is set to approx 8gig. Some existing servers are now running out of space. Is there an easy way to increase it without a rebuild ?

Thanks.

Reply
0 Kudos
17 Replies
MR-T
Immortal
Immortal

Eric has listed a number of methods on his web site here:

Dave_Mishchenko
Immortal
Immortal

Yes, you can do this. Basically you'll shut down the VM and then expand the vmdk files with vmkfstools. Then you'll boot the VM with a CD that contains a partitioning tool which will resize the C drive. A number of methods are documented here along with free tools to resize the C partition.

AWo
Immortal
Immortal

With the ESX command line utility "vmkfstools -X" you can expand the virtual disk (.vmdk). After this you need a partition tool to enlarge the Windows partition. There are several threads here which cover different ways to achieve the latter.

AWo

vExpert 2009/10/11 [:o]===[o:] [: ]o=o[ :] = Save forests! rent firewood! =
Reply
0 Kudos
Ardenvel
Contributor
Contributor

Cool, thanks all.

Have passed onto the experts to take a look Smiley Wink

Reply
0 Kudos
GordonG
Enthusiast
Enthusiast

If you are running Windows 2003 you don't need any third party tools to do this. I've attached a procedure I give to my customers to descibe how to do this:

1 Expanding a Virtual Disk

1.1 Increase the VMDK file

You may want to make a backup, clone or copy of the vmdk file first.

The VM must be powered down for this part. Putty or go to the console of the ESX host that the VM is currently owned by.

The command syntax is: vmkfstools -X new_size:G disk_name.vmdk

  • Where new_size is the size you want this disk to be (e.g. 15G will give a 15Gb VMDK disk file).

  • And disk_name.vmdk is the name of the disk file. If you're not sure use the VI Client to edit the settings of the VM and lookup the full name of the vmdk file.

Change to the directory where the VMDK resides and run the vmkfstools command. E.g.

cd "/vmfs/volumes/DB Backup Cork File and Print/FILE"

vmkfstools -X 350G FILE_1.vmdk

1.2 Expand the Windows Partition

Note that this will only work with Windows 2003 SP1 or later and only when the partition is the only one on the disk.

Power up the VM

Login to the server as an administrator

Open a Command Prompt (cmd)

Type Diskpart

Type list volume

Type select volume n

(where n is the volume/ partition you want to extend. Check the drive letters and use Disk Management to be sure).

Type extend

This will extend the selected volume to fill the entire disk.

Check the changes in Disk Management

1.3 Differences for an OS drive

If the partition we are trying to expand is the one that the OS is installed into, then we cannot run step 2 above (diskpart) while Windows is running.

The work around for this is to remove the vmdk disk from the VM and temporarily allocate it to another server.

Use the VI Client to connect to VirtualCenter

1.3.1 Remove the Disk from the Original Server

  • Select the Virtual Machine, right-click and select Edit Settings

  • Select the hard disk and select Remove (DO NOT select the option to Remove and Delete).

  • Click OK to apply the changes.

1.3.2 Add the Disk to the Temporary Server

  • Select the Virtual Machine, right-click and select Edit Settings

  • Click Add, then Hard Disk, Use An Existing Disk.

  • Browse to the datastore, directory and select the vmdk file that we are working with.

  • Click OK to apply the changes.

1.3.3 Expand the Partition

  • If the temporary server was shutdown boot it. If it was running, logon, go to Disk Management and do a rescan to detect the new disk.

  • Follow the steps outlined above to use DiskPart.

1.3.4 Remove the Disk from the Temporary Server

  • Shutdown the Temporary Server.

  • Select the Virtual Machine, right-click and select Edit Settings

  • Select the hard disk and select Remove (DO NOT select the option to Remove and Delete).

  • Click OK to apply the changes.

1.3.5 Add the Disk Back to the Original Server

  • Select the Virtual Machine, right-click and select Edit Settings

  • Click Add, then Hard Disk, Use An Existing Disk.

  • Browse to the datastore, directory and select the vmdk file that we are working with.

  • Click OK to apply the changes.

  • Power on the VM and check the disk in Disk Management.

Reply
0 Kudos
ascari
Expert
Expert

Ok vmkfstools -X ... but...sorry, you can not use diskpart on C volume.

Two vay for do this:

1) Use converter and resize disk during process.

2) Create another disk, connect it to VM and unse third part to diskcopy.

Bye

Alberto

Reply
0 Kudos
ponpalani2001
Hot Shot
Hot Shot

Hi,

We can extend C drive by connecting to a temporary windows client and the use a diskpart tool to extend the C drive. After extension map the HDD back to the original windows client.

Thanks

Reply
0 Kudos
GordonG
Enthusiast
Enthusiast

Ascari - If you read my procedure above, in 1.3 you will see that I recognise you cannot run Diskpart against an OS drive (C:), so I have documented temporarily moving the disk to a donor machine on which it is brought up as 😧 or E: (non system) and then running Diskpart there.

Reply
0 Kudos
ascari
Expert
Expert

yes, correct.

bye Alberto

Reply
0 Kudos
Troy_Clavell
Immortal
Immortal

Reply
0 Kudos
James-D
Contributor
Contributor

You can also use VM Converter. When going through the wizard it gives you the option to resize the disk. I have used this to do a number of machines. Smiley Happy

Reply
0 Kudos
Cameron2007
Hot Shot
Hot Shot

I have changed the size of system partitions successfully by using the method documented in my post on the attached link. I have tried this currently for W2K3 ENTx86, ENTx64,

http://communities.vmware.com/message/852101

Reply
0 Kudos
dkraut
Enthusiast
Enthusiast

Right on James! Using Converter works to both increase and decrease the size of the original vm template Hard Disk Drive and it does this without all the messy partition tools! Guys, Right click on your Template and choose Export. Follow the wizard making sure on the Options to Edit "Data to Copy" and then drop down on the Data Copy type and choose "Select volumes to copy". Drop down on your C: drive icon and choose the size you want it to be in the destination. Verify the Summary, submit and Voilà! go get a cup of coffee, surf the web for a few and you're all done. Smiley Happy

*If you want to export to a cluster, select your template as the source and your vcenter server as the destination and you'll be able to select the final destination server and datastore within the wizard.

Cheers!

Reply
0 Kudos
allukas
Contributor
Contributor

I followed these steps from this video I found on on You Tube and it worked with no problem.  I downloaded the software (Gparted) for free and created a CD using the ISO file.

http://www.youtube.com/watch?v=CjkeR1hskME&feature=related

Reply
0 Kudos
virtualeye
Contributor
Contributor

yes, gparted quickly solved a simple problem that otherwise proved to be a giant ass cake.

Reply
0 Kudos
vijayalka
Enthusiast
Enthusiast

Yes you are correct, we cannot use diskpart on 2K3, that can be only use when OS is 2K8 and no third party tool required.

We can also increase the C drive by using gpartition tool.

This is what I have used many times.

Reply
0 Kudos