PHPKB Knowledge Base Software Logo  
Guru Corner
Online Knowledgebase System  
Knowledge Base Home Knowledge Base Home
Home > All Categories > VMware > Administrative > Resize a VMWare disk
Question Title Resize a VMWare disk

There are multiple ways to perform this task.

AS ALWAYS, BEFORE YOU BEGIN, MAKE SURE YOU HAVE A GOOD BACKUP!

Method 1: Using VMWare Converter (tested with v3):

  1. Turn off the virtual machine;
  2. Start the VMWare Converter application;
  3. Open the Convert Machine wizard;
  4. Select 'standalone virtual machine' as the source and destination system;
  5. Choose 'Select volumes and resize to save or add space';
  6. Enter a new size and voilá, you're done!

Some say that the expand process is slow and that VMWare Tools might need to be reinstalled. A disadvantage is that Converter will create a new (many GB) copy of your VM.

Method 2: Using the VDiskManager:

  1. Turn off the virtual machine;
  2. Commit/remove all the snapshots first! (I forgot to mention this, thanks JimO). Or make a Full Clone if you use Link Clones.
  3. Open a Command Prompt and go to:
    C:Program FilesVMWareVMWare Server or C:Program FilesVMwareVMware Workstation
    or for 64-bit
    C:Program Files (x86)VMWareVMWare Server or C:Program Files (x86)VMwareVMware Workstation
  4. Run this command to expand the virtual disk:
    vmware-vdiskmanager -x 12GB "My harddisk.vmdk" (in this case, 12 GB will be the new size). The file name can contain spaces because of the double quotes.

  5. Note: Because this only expands the disk and not the partition, you'll need to resize the partition table as well. This can be done by 3rd party tools like 'Partition Magic', but also with 'diskpart.exe', a built-in tool of Windows. VMWare provides a list of tools on their web site: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004071

    I prefer to use Microsoft diskpart.exe.

Instructions for Windows Vista, 7 and 2008R2 are below!

If your VM runs Windows 2000, XP, Server 2003 or Server 2003 R2
If your resized virtual disk is bootable, you cannot use diskpart from the virtual machine itself. Use a 3rd party tool or use another virtual machine. Here I describe how to use diskpart.exe with a 2nd virtual machine.

  1. Add the increased virtual hard disk to a second virtual machine;
  2. Power on this 2nd virtual machine;

  3. Open a Command Prompt and type:
    diskpart

  4. Type:
    list volume

    Remember the volume number (#) of your volume!

  5. Type:
    select volume (the number from step 8)

  6. Type:
    extend

  7. Turn off this 2nd virtual machine and remove the virtual hard disk from the virtual machine configuration. This won't delete the hard disk file from disk;

  8. Your now finished! You can boot your VM with the resized disk. Windows automatically recognizes the new and correct disk and volume size.


If your VM runs Windows Vista, Windows 7, Windows Server 2008 or Windows Server 2008 R2
These versions of Windows ship with a more enhanced version of diskpart.exe that supports partition extension for bootable disks.

  1. Power on your virtual machine;
  2. Open a Command Prompt and type:
    diskpart

  3. Type:
    list volume

    Remember the volume number (#) of your volume!

  4. Type:
    select volume (the number from step 8)

  5. Type:
    extend

  6. Your now finished! You do not have to reboot.



How to Resize a VMs Virtual Disk (.VMDK)

When you created your virtual machine you of course created the number of disks and their sizes as per the requirements, best practice guidelines or just your best estimation for its use. However, as requirements change and the amount of data in your virtual machine grows, from time to time you need add additional storage. How do you resize the virtual disk (.VMDK)?

Resizing virtual disks is relativley straight forward. However, as with anything before making changes ensure you have a backup (especially when making changes to disks).
Note: You cannot change the disk size if you take a snapshot, plus if there was an issue with the disk the snapshot would be useless anyway.

Another thing to be aware of is you can only INCREASE the size of a virtual disk. You cannot reduce the size of a virtual disk, VMware does not currently allow it as it could risk losing data. If you want to reduce the disk size you could either use VMware converter to copy the VM and resize the disks at the same time or create a new smaller virtual disk and copy the data over to it.


To Increase the size of a virtual disk (.VMDK):
1. Shutdown the virtual machine.
2. Right click on the virtual machine and select "Edit Settings".
3. On the "Hardware" tab, select the virtual disk you would like to resize and in the "Capacity" section enter the required size.



We are not finished yet. If you boot the virtual machine now the OS will not see the new size, it will only see the old size. You need to expand the volume into the new free space. Below are two methods of doing this, and depding on the guest OS and your preference depends which one you will choose.
Method 1 (Windows DISKPART) will of course only work in windows.
Method 2 (GParted) will work for any OS, including Linux and Unix provided as the filesystem type is supported by your chosen partitional utility.

Method 1 (Windows DISKPART):
1.
Click Start --> Run and type "diskmgmt.msc"
2. You will see the free space after your volume.



3.
Use DISKPART to extend the volume into all the free space:
diskpart
list volume
select Volume 0
extend
exit



4.
You will now see the volume has been extended to use all the free space.



Method 2 (GParted):
To resize the partition on the disk use your favourite partition resizing tool. If you dont have one mine is GParted, which there is a live CD for.
Download the GParted Live CD

1. Click on the "Options"  tab and go to "Boot Options".

2. Tick "Force BIOS Setup" (This will boot into the BIOS screen when the VM is powered on - This is so that you can mount and ISO image before the OS boots.)

3. Click Ok to reconfigure the virtual machine.


4. Connect the ISO image or connect the CD drive with your GParted Live CD (This is easier with force BIOS option set in step 5).


5. Boot into GParted and you will see the current partion in the now much larger disk.


 

6. Right click on the partion and select "Resize/Move".


7. Resize the partion to fill entire remaining space and click "Resize/Move".


8. Click "Apply" to run the resize task. After sometime depending on the size the task will complete.

9. Reboot the computer, remove the CD and boot into the OS.


10. Depending on the OS it may perform a disk check like Windows Server 2003 here.


11. You should now see the disk has been resized.


Authored by: Guru Corner
Click Here to View all the questions in Administrative category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
Article Information Additional Information
Article Number: 206
Created: 2012-04-01 2:13 PM
Rating: No Rating
 
Article Options Article Options
Print Question Print this Question
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
 
Search Knowledge Base Search Knowledge Base
 
 

Powered by Guru Corner