Welcome to EMC Consulting Blogs Sign in | Join | Help

Kalpesh Prajapati

How to Extend Virtual Machine Hard Disk ( VMWare)

After long process of Goggling and experimenting I found few documents which partial solution to Extending Hard Disk is given. I have create straight forward steps for future reference and going to blog this next. Please let me know if steps need more info or typo found. It took my 2:30 hours and let me know how much time you will need to do same thing using following steps

Here are steps to extend Virtual Machine’s Primary hard Disk

Scenario:

I have Virtual Machine(M1) with pre-allocated hard disk of size 6 GB. All the software and OS is installed on this disk. Latter state I need to install more software but disk is full and new software has to be installed on primary hark disk only. I have VM Server installed on Primary Drive. Let’s say Primary Drive is C. I want to make increase size to 10GB. My Virtual Hard Disk file is located at c:\mydisk.wmdk.

How to do?

This can be achieved by extending primary hard disk. Here are steps to do this. For this you need one more Virtual Machine. Assume we have two Virtual Machine M1 and M2. M1 is my working VM. M2 had Windows 2003 installed on it.

1.    Turn off virtual Machine.

2.    Start Command Window on Host Machine.

3.    Move to VM Server directory. i.e. C:\Program Files\VMware\VMware Server

4.    Type Command  vmware-vdiskmanager.exe -x 30Gb c:\myDisk.vmdk ( This will create 10 – 6 = 4GB of unallocated space on primary drive)

5.    Now Move to M2’s Edit Virtual Machine Settings. Select Hard Disk and Click Add button.

6.    Select Hardware Type Hard Disk and Press Next

7.    Select Use an existing Virtual Disk and Press Next

8.    Select Primary drive of Machine M1 and Press Finish

9.    Start Virtual Machine M2.

10. Move to Control Panel -> Administrative Tools -> Computer Management -> Storage -> Disk Management.

11. You will see you list of Virtual Disk with allocated and unallocated space.  Let’s say new Virtual Disk is listed as Disk 1.

12. From the run menu type "diskpart.exe" to enter the command line utility to resize disk partitions in Windows Server 2003.


13. The command list volume will show you all the available volumes. Select your volume as shown below. select volume 1 corresponds to the "D" volume that I want to extend. Finally extend the volume with the extend command.


14. If all goes well, the partition will be immediately extended under the Disk Management snap in.


15.  Shut down the second Virtual Machine(M2) and remove the disk from the second Virtual Machine. Power on the first Virtual Machine(M1) and check out your new space.


 

Published 24 July 2007 11:55 by kalpesh.prajapati

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

N0F3@R0720 said:

Excellent tutorial !!! Even though i haven't try it out, but those steps are kinda easy~~~

cheers,

August 6, 2007 10:54
 

pb said:

This actually works! Well written steps and I now have a 10Gb hard disk on my virtual machine.

August 14, 2007 11:54
 

Guest said:

These instructions are very similar to these: http://vmprofessional.com/index.php?content=2k3resize. So similar that the computer name in the Command Prompt screenshot are identical. Quite strange, isn't it...

December 14, 2007 16:16
 

Hajo Ehlers said:

Another approach is to use mirroring. No need for an additional windows 2003 running.

Details for mirroing windows 2003 server read http://support.microsoft.com/kb/323432

Basic steps:

Given: disk 1 scsi 0:0 4G

Do:

- Shutdown windows 2003

- Create a new disk for the client like disk2 scsi 0:1 with 10GB

- Start W2003 and acctivate the new disk

- Convert disk type to dynamic

- Mirror from volume 1 to volume 2

Ignore error message regarding boot.ini

- remove mirror from volume 1 -  System is on volume 2

The boot.ini point still to volume 1 - DO NOT CHANGE.

- shutdown w2003

From VMware

- remove disk1 ( scsi 0:0 )

- Reconfigure disk ( scsi 0:1) to ( scsi 0:0)

Start w2003

Now you have a C partition with 4GB on a 10GB disk. Just extend your current partition.

regards

Hajo

May 7, 2008 16:37
 

magnum said:

Hajo,

>> Now you have a C partition with 4GB on a 10GB disk. Just extend your current partition.

My Windows says: "The selected volume is a system or boot disk or was created on a basic disk in an earlier version of Windows and cannot be extended."

And couldn't do extension...

May 27, 2008 16:42
 

Nikolajus said:

Not working for me as well

June 6, 2008 09:27
 

Richard said:

Another (much easier) way to increase disk size is to use "VMWare Converter", which is a free download.

July 4, 2008 09:34
 

fola said:

thanks

August 4, 2008 16:51
 

TRUNGPV said:

That's greate

Thanks

August 7, 2008 04:53
 

yhy said:

yty

August 21, 2008 13:24
 

Ivan Versluis said:

Thanks it helped me solving my problem. Check my post here with VMWare ESX server and Windows Server 2003 basic volume.

http://www.networknet.nl/apps/wp/archives/474

Ivan Versluis

September 28, 2008 21:00
 

jean-jacques said:

Excellent article, I saw another method (article is in french) but with a video demonstration and it is concerned with system drive (diskpart is not usable in this case). They used gparted to resize the C:\ drive) if interested go to www.ntsysv.com (as it is in french look for "Extension du disque système")

thank you again for the tutorial.

October 29, 2008 19:42
 

Harley said:

Absolutely fantastic.

I worked perfectly.

You are the man.

November 9, 2008 00:38
 

VM user said:

Kalpesh,

Thanks a bunch,

You saved my day...

November 13, 2008 04:19
 

Roumen Semov said:

<QUOTE>

magnum said:

Hajo,

>> Now you have a C partition with 4GB on a 10GB disk. Just extend your current partition.

My Windows says: "The selected volume is a system or boot disk or was created on a basic disk in an earlier version of Windows and cannot be extended."

And couldn't do extension...

</QUOTE>

Looks like Linux is here to fix the garbage that Windows is. here's how I expanded Windows'es system disk for him (windows). For background purposes I run Windows VMWare virtual machine on top of my Linux desktop.

1. Create the extra disk space as indicated in guide above. Complete step #8 and stop there.

2. Go to VM->Settings on the VMware window and set up the box to boot from a CDROM. It will be under "CD/DVD", click on "Use ISO image:", and select a bootable Linux ISO off your host machine. I used Knoppix but now Fedora has Live CD's so you can use that too. Or you can put a Linux Live CD media in your CD-ROM and use that.

3. Reboot the virtual Windows machine and push F2 to get into the BIOS. There shuffle boot sequence to boot from CD-ROM first. Save BIOS settings and restart

4. VM box will boot off of the ISO image (or CD-ROM - whatever you set it to in my step #2 above). When it finally comes up find out how the kernel named your Windows virtual disk. Mine was called /dev/hda1 so yours was too. I will refer to it as /dev/hda1 in the next steps.

5. Run fdisk /dev/hda, remove the partition and recreate it to include the rest of the disk you had allocated. save partition changes and exit out of fdisk.

6. Run "resizentfs /dev/hda1" and it will resize the NTFS filesystem to the size allowed in the fdisk of step 5 above.

7. God willing, if no errors came up in step #6, reboot windows and don't forget to change boot sequence in BIOS to original - to boot from hard disk first.

8. Windows might be a little confused about the changes without its knowledge so it will ask you to do a "C drive consistency check". let it run through. Windows will ask you to restart once the check is complete. Go ahead and restart. Now you should see your whole disk.

Pretty cool huh? Cost in commercial software purchases: $0.

Time it took me to expand my disk: ~15 min.

January 23, 2009 20:31
 

Double said:

If you extend the disk with vmware-vdiskmanager.exe -x 30Gb c:\myDisk.vmdk you can boot to BART (or whatever) and extend it with diskpart.

This way you don't have to go through the rigamara of the second machine; so four step –

1) Turn off machine

2) Extend disk (vmware-vdiskmanager.exe -x 30Gb c:\myDisk.vmdk)

3) Boot to bart / diskpart / select volume / extend

4) Reboot to Winders

When you boot for the first time you might get prompted that new hardware was installed and have to reboot one more time.

February 20, 2009 03:45
 

ahsan said:

what a bunch of bullshit.  why is it so complicated to freakin increase size.

what a bunch of total bullshit.

March 3, 2009 09:03
 

ahsan said:

Stop everthing.  

This is what you do:

0) shut down your vmware image (shutdown  windows etc)

1) open vmware, go to settings, and under hard disk settings increase the size.  Click apply etc.  

2) notice not a damn thing happens because vmware is a CRAP ***ING SHOOOT

3) Start the windows machine

4) oh surprise, nothing changed.

5) start->control panel->adminstrative tools->computer management->disk management.  You notice there some unallocated space.  well thats the one that was suppose to get attached to your drive.  but crap all happened cuz it sux ass.

6) go get this tool: http://support.dell.com/support/downloads/download.aspx?c=us&cs=19&l=en&s=dhs&releaseid=R64398&formatcnt=2&fileid=83929 .  Its called: ExtPart.exe from dell.

7) extract, save whatever.  Run from the command prompt as such: Start->run->cmd

->suppose you wanted your C drive which is now full, to be increased by 2gigs.  And further suppose you did the earlier steps and went into the hard disk settings and increased there by 2 gigs, and furhter suppose that in disk management (step 5) you saw 1.99 gigs unallocated.  Then :

go to the C:\dell\ExtPart location (likely where u extracted it) and run the exe.

Then you will see:

Volume to extend (drive letter or mount point): c: 2048  

The c: 2048 is what you type.

FUCKING DONE!  Now how damn EASY WAS THAT!  

March 3, 2009 11:38
 

VMBiohazard said:

The only reason nothing is happening, is because you are not using the tools correctly. Trust me, these are NOT hard instructions and usually take little time. Another alternative is to use VMware Converter. It's free and easy to use! You set a couple parameters and kick off the increase and the converter does it all for you. Then simply start up the VM and you are good to go.

Cheers,

VMBiohazard

March 5, 2009 01:13
 

MCF said:

Ashan you'll do for me.

Your instructions were quick and easy no fannying about.

Niceone!

MCF

March 18, 2009 16:19
 

Ahsan said:

MCF: you are welcome.

Here is something funny: I tried these steps again and it didnt work.  I was extremely pissed off.  After 2 weeks of on and off research let me share what i found so for others who search and find this site dont run into same issue:

EXTPart was saying: sorry, *** u, i cant work cuz i dont have enough space to work.

If this happens to you or even if diskpart fails on you, MAKE SURE that you realize that windows is absolute crap.  Then go to disc management.  Thats: start->run->diskmgmt.msc and ensure that you have beside the primary partition unallocated space.  The thing is that if you have a logical drive beside the primary partition windows gets high on its on crap fumes and doesnt work.  This is for xp and vista.  My workaround to this problem:

Copy content from logical to my MAC aww yea!  and then instantly extpart worked!

what a time killer.  FU windows.  thanks for wasting my couple of days once again!

April 13, 2009 00:53
 

Alex van der Linden said:

Thanks Kalpesh

May 11, 2009 16:52
 

alex said:

Thank you ahsan! You saved me a lot of hassle :)

June 1, 2009 21:27
 

matt said:

relly great!!! thanks a million

June 18, 2009 18:34
 

SAM said:

that great thanks a lot dude.....

July 13, 2009 18:14
 

AJ said:

Amazing step by step guide

July 24, 2009 13:10
 

Amit said:

Excellent tutorial.....worked for me....only thing to keep in mind is delete all the snapshots before doing this

August 5, 2009 15:02
 

gose said:

Worked fine for me... Thanks!

August 7, 2009 21:02
 

Homam Said said:

Hi,

I just want to thank you for your great job in collection and writing the steps in a clear way. I tried this and it worked with me.

Thank you

August 17, 2009 13:16
 

Philip Manual said:

Excellent step by step guide.. I've double the disk size on C:\ drive. Thanks

September 4, 2009 10:40
 

max said:

you guys have not posted anything that works for a boot disk (or C drive)...

Ahsan.... you are not smarter than anyone else here... your dell utility simple does not work for a boot disk...

Max

September 11, 2009 02:28
 

Benson said:

It worked for me Thanks a ton!

September 11, 2009 09:05
 

davetiyeci said:

düğün davetiysi ve davetiye sözleri

November 20, 2009 09:13
 

Paul Evans said:

Comprehensive Survey of tehcniques to Extend / Expand virtual disks - VMWare, Fusion, VMware Server, VM Workstation, esx, including this post

http://blog.sharevm.com/2010/01/11/survey-extend-expand-vmware-virtual-disk/

January 15, 2010 01:42
 

Paul Evans said:

You should download and try fatVM (http://www.gudgud.com/fatvm). It provides a 1-click solution for extending the C drive of your VMware Fusion or Workstation virtual disk that is becoming full.

February 10, 2010 23:54
 

Wayne said:

This does work well, lately I have been using the GParted live CD iso.  Just boot from it and use GParted to extend the C: drive.  Then you don't need a helper machine and you can't accidentally delete the disk (instead of just removing it).

February 19, 2010 15:28
 

refurbished computers said:

I just want to thank you for your great job in collection and writing the steps in a clear way. I tried this and it worked with me.

July 19, 2010 16:37
 

ahsan said:

I have left a post previously on this topic.  I have been using this site frequently enough to solve this issue.  However with windows 2008 the solution i suggested earlier does not work.  I used diskpart however i did not create 2 vms etc.

I simply did the following:

problem: ran out of space on primary partition.  i.e c:\ is 99% full.

solution:

1) shutdown vm

2) increase size (vmware fusion) in hard disks.  I jacked it up by 10 gb.

3) start vm

4) log in, and open the command prompt and also open disk management and notice the new 10gb of unallocated space.

5) type diskpart.exe in command prompt and enter.

6) select your volume (c drive).  To determine what your volume is and how to select it and make it the 'focus' etc you simply type:

List

List Volumes

select Volume <x> where x is the number of your volume.  You can figure out which is yours by looking at the sizes.  your full partition should be in one of the volumes listed.

then type: extend size=2048

in disk management, you should see your file size of unallocated space shrink and c:\ parition increase..

August 4, 2010 20:11
 

Ananthahk said:

Hello All,

I Followed the above steps but still get message

The volume you selected may not be extended.

Please select another volume and try again.

My VM OS Windows XP 64 bit, any help appreicated

August 12, 2010 05:34
 

RHS said:

Usually DISKPART doesn't work if you have a pagefile on the partition to be extended. You may need to add another drive and move the pagefile to this before it will work

August 27, 2010 16:58

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems