Table of Contents

Resize ESX Virtual Disk

Summary: How to resize a ESX Virtual Disk.
Date: Around 2012
Refactor: 22 March 2025: Checked links and formatting.

It's possible to resize disks in a VMware ESX / Infrastructure environment. Increasing is easy, and there's almost no risk on losing data. If you need to make a disk smaller you should always turn the guest off, since there is a serious chance of losing data. To resize disks there are two steps to follow, first resize the actual disk and then you need the guest operating system to recognize the new available disk space.

Disk Resize

There are two ways to resize disks:

Through the Client

resizeclient.jpg


Through the Commandline

Before you start following this procedure keep these points in mind:


Procedure:

vmkfstools -X <new size> <disk name>.vmdk

Operating System

Windows and Linux

Linux Extra

In linux you could also assign the disk to another guest to resize the partition, you can use the normal system tools then. In Suse, that would be: Yast2 → System → Partitioner.

Note

Not so long ago, I tried this procedure on a SLES 10 SP2 box and ran into some problems. I downloaded the latest Knoppix version, 6.2.1 and there was no qtpart application available, on both the CD and the DVD. So eventually, I resized the disk using 'gparted'. When I rebooted the machine I ran into the problem that only the partition was resized and not the file system: Partitioner:

/dev/sdb │     20.0 GB│   │VMware-Virtual disk│       │        │    0│2609│
/dev/sdb1│     19.9 GB│   │Linux native       │/opt   │K       │    0│2609│

This is however what df -h said:

/dev/sdb1             9.9G  4.2G  5.3G  45% /opt

So, I still had to resize the filesystem:

slesbox:~ # resize2fs /dev/sdb1
resize2fs 1.38 (30-Jun-2005)
Please run 'e2fsck -f /dev/sdb1' first.

slesbox:~ # e2fsck -f /dev/sdb1
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 9143/1310720 files (8.1% non-contiguous), 1205470/2620595 blocks

slesbox:~ # resize2fs /dev/sdb1
resize2fs 1.38 (30-Jun-2005)
Resizing the filesystem on /dev/sdb1 to 5241198 (4k) blocks.
The filesystem on /dev/sdb1 is now 5241198 blocks long.

After these steps I could mount the filesystem again and use the new space:

slesbox:~ # mount /opt

slesbox:~ # df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1              20G  4.5G   15G  24% /opt