Increasing the size of a virtual disk in VMware

From Thomas-Krenn-Wiki
Jump to: navigation, search

This article will describe the steps necessary for increasing the size of virtual hard disks under VMware. This procedure is necessary for adjusting the virtual machine to the growing needs for storage.[1]

Information Important before Beginning

Although this article describes how the size of virtual hard disks can be increased, the size of the partitions with the guest operating system will remain unchanged. To change the partition size, the necessary steps must be made for the specific operating system.[2]

Attention

  • VMware recommends making a backup of the virtual machine before changing the size of the virtual hard disk.
  • The process is different for various VMware products. Please follow the description appropriate for your VMware product.

Conditions

Before increasing the size of virtual hard disks, the following conditions must have been fulfilled:

  • Delete all snapshots that have been made.
  • Turn off the virtual machine.

Note regarding the Instructions

So that the following instructions will work, you will have to replace any references to vm.vmdk with the complete path to the virtual machine’s virtual hard disk.

Comment: If there are several .vmdk files with the same base file name, select the one whose file name does not contain a -flat or -s0.

You have the following options for finding the complete path to the virtual hard disk:

  • Discovering the complete path to the vmdk file for the virtual hard disk of a hosted virtual machine (non-ESX hosts)[3]
  • Discovering the complete path to the vmdk file for the virtual hard disk of an ESX host[4]

VMware Player 2.x or ACE Instances

Changing the size of a virtual hard disk directly is not possible, if you are using VMware Player 2.x or an instance of ACE is involved.

  • ACE Instance: The size of the virtual hard disk must be changed in the ACE manager.
  • VMware's Player 2.x: Only upgrading to VMware’s Player 3 will help. You can download this version from the following link: Downloading VMware Player 3.x (VMware download site).

Workstation, Player 3.x, ACE Manager, Servers and GSX

Increasing the Size of the Virtual Hard Disk from the Command Line:

  1. Open a new console.
  2. Move to the installation directory for the product.[5]
  3. Enter the following in the console and confirm the entry using the Enter key:
    vmware-vdiskmanager -x 100Gb vm.vmdk
    • Comment: Replace the entry 100Gb with the new desired size. You can also specify the size in Kb or Mb.
  4. Execute the steps according tot he VMware Knowledge Base[2] , in order to adjust the guest operating system’s partitions to the new hard disk size.

Under Workstation 7, you can adjust the size of the virtual hard disk from the graphical interface:

  1. Select the corresponding virtual machine in the list.
  2. Click on Edit virtual machine settings.
  3. Select the Hard Disk menu item.
  4. Click on Utilities > Expand.
  5. Enter the new size and press Expand.
  6. Execute the steps according tot he VMware Knowledge Base[2] , in order to adjust the guest operating system’s partitions to the new hard disk size.

ESX, VI Client and vSphere

Comment: Under ESX 4.1, you can also add, and extend, virtual hard disk while the machine is running (an installed copy of VMware Tools is a pre-requisite for this).

The following error may appear in some circumstances:

Failed to open the disk 'vm.vmdk' : A file was not found (0x1900000004)

This error does appear, you should ensure that the virtual machine can be successfully booted and that all snapshots have been deleted. If the error continues to exist, contact VMware support.

If you are using ESX 3.5 or later:

  1. Open the VMware Infrastructure (VI) client and connect with vCenter or the ESX host machine.
  2. Right-click on the virtual machine.
  3. Click on Edit settings.
  4. Select Virtual Disk.
  5. Enter the desired size for the virtual hard disk.
  6. Execute the steps according tot he VMware Knowledge Base, in order adjust the guest operating system’s partitions to the new hard disk size.[2]

Earlier Versions von ESX: For earlier versions of ESX, you will have to increase the size of the virtual hard disks from the console.[6]

Lab Manager

Warning: Any attempt to change the size of an existing virtual hard in Lab Manager will lead to complete loss of the data. Do not attempt to change a virtual hard disk using Lab Manager after the fact.

Procedure: Instead, create a new virtual machine with the desired hard disk size. Afterwards, create a backup of the virtual machine and copy this backup to the newly created virtual machine afterwards.

Additional Information

References

  1. Increasing the size of a virtual disk (VMware Knowledge Base)
  2. 2.0 2.1 2.2 2.3 Increasing the size of a disk partition (VMware Knowledge Base)
  3. Locating a hosted virtual machine's files (VMware Knowledge Base)
  4. Verifying that ESX/ESXi virtual machine storage is accessible (VMware Knowledge Base)
  5. Locating a VMware product's installation directory (VMware Knowledge Base)
  6. Adding space to an ESX host virtual disk (VMware Knowledge Base)

Related articles

Differences between VMware ESX and ESXi
Monitoring MegaRAID Controllers in VMware
VMware Upgrade Process - Migrating from vSphere 4 to vSphere 5