Skip to content

Instantly share code, notes, and snippets.

@watsonian
Created March 5, 2012 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save watsonian/8be0899981e4bfe9472b to your computer and use it in GitHub Desktop.
Save watsonian/8be0899981e4bfe9472b to your computer and use it in GitHub Desktop.

Before You Start

It's important to note that you should NEVER decrease the volume's size. This process should only ever be used for increasing the volume size.

Shutdown the VM

Before you do this you'll need to shutdown the running VM. Once that's done, you can proceed with growing the VMDK.

Grow the VMDK file

Note that in some cases the UI elements for growing the size of your disk may be disabled. This will sometimes happen if you have snapshots for the drive -- deleting those snapshots may allow you to grow the volume again. If you encounter any other issues attempting to grow your existing VMDK volume try checking VMware's knowledge base.

Using vSphere Client

The easiest way to do this is to resize the hard disk inside of vSphere Client. Connect to your ESXi server, right-click on your Enterprise VM, and choose Edit Settings.... After doing that select the hard disk you want to grow on the Hardware tab. On the right side of the window should be a Disk Provisioning area where you can adjust the size of the disk similar to this:

Increase the size to whatever you like (you should only ever increase this size -- don't ever decrease the volume size).

Using VMware's Remote CLI

You can also grow your VMDK using the VMware vmkfstools CLI utility. You'll need to download the tools first if you don't already have them. The command you'll be using will be something along these lines:

vmkfstools --server [esxi-server-ip] -X [newsize]G /vmfs/volumes/[datastore-name]/[vm-name]/[filename].vmdk

Note that [newsize] is the new total size -- not how much you're growing the volume by. You can find full documentation for the CLI utility here.

Growing the Repository Volume

Now, even though the VMDK is larger, the filesystem on the VM doesn't know it yet.

Browse to http(s)://[hostname]/setup/growfs/repo. That should grow the filesystem. You'll want to copy the output you get here for future reference in case you need to contact support later. You can confirm that the grow occurred by the df -h output that's shown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment