« Thank you France! | Main| Increase the size of your VMWare disk drive »

Increase the size of your VMWare disk drive

Category
If you're like me you probably have a few older VMWare Images, where you made the disk size a little too small. Fortunately in VMWare Workstation you can change the size of a disk with a simple command line program (how long till someone builds a VB frontend I wonder?). Sadly the command only makes your drive bigger not the actual partition... So how can you can get around that without purchasing a product like Partition Magic? Well it turns out the OpenSource and Linux world have a solution "QTParted", all I did to resize the drive now was issue the VMWARE command line to resize the disk (in this case to 10Gb):

vmware-vdiskmanager -x 10GB myDisk.vmdk

Then I set the vmware session to boot of the Knoppix ISO CD image. and ran QTParted, selected the Windows Drive partition with the right mouse button and chose reseize, set the new size, and then committed the change. Voila my disk had it's size increased with all data intact.

Comments

Gravatar Image1 - I am also trying to do this, in fact there is a tool that successfully does this called VMmanager (on sourceforge) but when I run Knoppix I have a swap file that I cannot seem to move or remove in order to add the new available space to my VMware disk. <br><br>Can anyone help please ?

Gravatar Image2 - i just had to resize my vmware disk image from 8gb -> 12gb (single drive), and i recommend you do the following:

a) resize your disk

vmware-vdiskmanager -x 12GB image.vmdk

this will resize your disk, but it WONT resize the partition correctly.

b) use another vmware setup, add your disk as a secondary disk (so, it isn't a system disk)

c) boot other vmware setup

d) use the windows 'diskpart.exe' program to fix the partition

programs -> run -> diskpart.exe
show volume
select volume 2 (this may be another, check it)
extend
exit

e) shutdown, remove drive and startup original vmware


Gravatar Image4 - You want a VB interface? Here you go:

http://opensource.ebswift.com/VMDiskSize/

Enjoy ;)

Gravatar Image5 - <i>ut when I run Knoppix I have a swap file that I cannot seem to move or remove in order to add the new available space to my VMware disk.</i><br><br>When you boot Knoppix, on the boot prompt type "knoppix noswap" so it won't mount the swap partition. Then you will be allowed to remove/erase/move/whatever the swap partition.

Gravatar Image6 - PlanB - It doesn't appear the GParted live CD supports VMWare (I get a black screen after booting).

Gravatar Image7 - I released a VB frontend for this back in September
http://petruska.stardock.net/software/vmware

Rob

Gravatar Image8 - You can extend the size of the partition using windows utility diskpart.exe - works on Win2k and later.
See http://support.microsoft.com/kb/325590

Tony

Gravatar Image9 - I really like System Rescue CD for this (and other tools)
http://www.sysresccd.org/ (URL above). It has stuff for copying partitions etc etc. Of course now VMWare have their free "translate a VPC image to VMWare" tool some of that's not so necessary any more.

Gravatar Image10 - MS page says this about diskpart.exe:
"Only the extension of data volumes is supported. System or boot volumes may be blocked from being extended..."

Of course good old sysresccd has a bunch of tools to handle this. ;)

Gravatar Image11 - This works only if there arent any snapshots created on the virtual disk being increased.

Gravatar Image12 - If you want to expand a VMWare boot disk which has snapshots, I just did the following and it worked great:

(Following assumes you created your only drive as a single SCSI disk. If not see the end of this comment.)
- Make a GOOD backup of your virtual machine
- Download ISO of KNOPPIX linux from http://www.knoppix.net/get.php
- Download ISO of gparted live CD from http://gparted.sourceforge.net/livecd.php
- Add a 2nd larger disk to your VM (Make it the size you need)
- Change the CD drive to use the KNOPPIX .iso file and make sure it is set to connect on boot
- Boot the VM, press F2 to go into BIOS setup amd make sure the CD-ROM is in the boot order before the HD
- Once KNOPPIX boots up click on the penguin icon and choose "Root Shell"
- At the shell prompt run the command
WARNING - If you have multiple drives configured you will have to make sure that you don't clobber the contents of an existing drive. All recognized drives should appear as icons (usb thumb drives in some cases for reasons unknown to me.) You can single-click on one of them and view the contents. A brand new drive you just created shouldn't be viewable. Note the drive name (sdb, sdc, etc) and use that in place of sdb in this command.
dd if=/dev/sda of=/dev/sdb bs=65536 and wait for a while for it to finish.
- Click on light blue box (in the lower left of the screen)
- Click on 'Log Out"
- Click "Turn Off Computer"
- Once KNOPPIX has finished shutting down you can shut down the VM safely
- Go back into your VM settings and change the CD-ROM to use the gparted .ISO image instead of the KNOPPIX .ISO
- Boot VM again and accept all defaults during the gparted bootup
- In the upper-right corner of the main gparted screen, change the drive from /dev/sda to /dev/sdb
- Now you can use gparted to expand the filesystem to fill the entire larger partition. (Beware of older OSes which can not handle very large partitions... you DO have a backup, right?)
- Click Apply
- Once gparted has finsihed you can power down the VM
- Set your CD-ROM back to the physical CD-ROM device or however you normally have it configured
- Remove your original (small) disk (yes, I know this part is kind of scarry)
- Go into the settings for your new larger disk
- Click on Advanced...
- Change the Virtual Device Node to SCSI 0:0
- Boot your VM and let it do a disk check
- You may have to reboot one more time but eventually it will stop complaining that things have changed.
- Don't forget to do a snapshot after all this work!

-Cleanup-
If you delete all of the older snapshots that used the original disk you can go ahead and delete the .vmdk files that it was stored in. (Do this at your own risk.)

-IDE Drives-
There are a couple things you probably want to do differently if you set up your VM using IDE hard drives instead of SCSI. The first is that drive letters are based strictly on which IDE node you assigned in your VM setup. Here are the adjustments to the above instructions you'll want to make for IDE VM disks.

- When adding your new larger disk, note the node of both the new disk and the old. The nodes translate to the following Linux drive names:
IDE 0:0 - /dev/hda
IDE 0:1 - /dev/hdb
IDE 1:0 - /dev/hdc
IDE 1:1 - /dev/hdd

- When you first open up the "Root Shell" in knoppix you might want to run hdparm to enable DMA for each IDE disk you are going to work with. IE:
hdparm -d1 /dev/hda
hdparm -d1 /dev/hdc

- When running the dd command, you'll need to use the right drive device names. ie:
dd if=/dev/hda of=/dev/hdc bs=65536

- When running gparted, again, you'll need to make sure you use the correct drive... though it'll be obvious you have the wrong one since there won't be a bunch of free space like you are expecting.

Gravatar Image13 - I am also trying to do this, in fact there is a tool that successfully does this called VMmanager (on sourceforge) but when I run Knoppix I have a swap file that I cannot seem to move or remove in order to add the new available space to my VMware disk.

Can anyone help please ?

Gravatar Image14 - Ahh well!!! Missed this one!

Gravatar Image15 - ut when I run Knoppix I have a swap file that I cannot seem to move or remove in order to add the new available space to my VMware disk.

When you boot Knoppix, on the boot prompt type "knoppix noswap" so it won't mount the swap partition. Then you will be allowed to remove/erase/move/whatever the swap partition.

Gravatar Image16 - What if I'm trying to do this for a VM that is Red Hat Enterprise Workstation 4? I have successfully made a large drive, but when I run gParted, it doesn't recognize the Linux Filesystem and can't resize it. :(
Any suggestions?

Gravatar Image17 - Resizing with diskpart.exe works fine.
You can add the VM disk to another VM and call diskpart. But you need to assigne a drive letter to the disk that shall be resized before you run diskpart. Otherwise you get an error message.

Gravatar Image18 - Hi all,
Aaron Ardiri can you be more specific about point b) ? Do you mean i enter the setup and put in on Slave? Didn't get it very well..

Thanx in advance

Gravatar Image19 - I have written a blog post of my experience of expanding a virtual disk within a vmware at http://www.seandeasy.com/expanding-a-drive-within-a-vmware-image/
It is a step by step tutorial with screenshots. I hope it helps someone.

Gravatar Image20 - After resizing with vmware I used Partition Magic 8.05 running inside the (XP) guest, and the resize "Just Worked", didn't even need a reboot, Windows just saw the extra space.



Gravatar Image21 - I just used VMWARE's free Utility VMWARE Convertor.

Import the existing vm, change the disk settings to the new bigger disk sike and let it create the new machine.

I am trying it now

Gravatar Image22 - Emoticon

Gravatar Image23 - VMware partition resize
I had created a virtual machine of c: 10 gb and wanted to increase it to 20 gb


1) Shutdown the virtual machine

2) From the host computer ran vmware-vdiskmanager -x 20GB Windows Server 2003 Standard Edition/Windows Server 2003 Standard Edition.vmdk

3) On rebooting the c: was still showing 10 gb in the properties and disk management was showing 10 gb disk.

4) Booted with KNOPPIX_V5.1.1CD-2007-01-04-EN.iso and took a backup of the partition to network share with partimage

5) Created a new virtual machine with 20gb as disk size

6) Booted with KNOPPIX_V5.1.1CD-2007-01-04-EN.iso and ran fdisk created a partition of 20gb with type 7 and bootable

7) Restored the image with partimage

8) Booted with KNOPPIX_V5.1.1CD-2007-01-04-EN.iso. fdisk show one partition of 20 gb but on mounting the partition it was showing 10gb in df -h

9) Unmount the partition and ran ntfsresize. Mount it again and it was 20 gb in df -h

10)Rebooted and found blinking cursor with no errors

11) Booted with windows 2003 iso.

12) Went to repair mode and ran fixmbr

13) Rebooted and found windows 2003 with c: 20 gb with all data intact.


Emoticon

Gravatar Image24 - Emoticon Emoticon

Gravatar Image25 - That is similar to the procedure I use at <a href="{ Link } when I expand a vm.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::rolleyes:;-)