VMware ESX / Virtual Center – Extend Virtual Disk
Ok, I’ve already written about extending a virtual disk in VMware ESX Server / Virtual Center here. I spent the last view hours exactly for that task… |
![]() |
In the VMware Infrastructure Client GUI I selected the the virtual machine with the right mouse button, selected Edit Settings, selected the Hard Disk Number 1, and under Capacity I entered a new value of 48 GB. I wanted to enlarge (the disk.. ) / extend the disk from 24 gigabytes to 48 gigabytes. Everything fine I thought. I clicked on OK and assumed that the change has been committed, because I the task pane, I got a green success ball that normally indicates: everything’s fine.
BUT, when I later booted Windows PE to extend the disk partition using diskpart, I realized, that the disk geometry hasn’t been changed. I check the Hard Disk Number 1 in the Virtual Machine Properties page and voila, the disk was still 24GB. I thought, ok no worries chris, there must be snapshot. Delete that bastard and try it again. WRONG, there was no snapshot. Ok, I the past I often had issues with the VMware Infrastructure Client GUI, and I’m an old DOS Batch guy anyway – I opened an Putty SSH Shell, connected to the ESX Host and tried to extend the partition using VMKFSTOOLS as documented here.
[root@vmdesx001 VMDSRV004]# vmkfstools -X 48G VMDSRV004_C.vmdk
Failed to extend disk : There is not enough space on the file system for the selected operation (13).
Failed to extend disk, not enough disk space .. wtf, there’s about a quarter terabyte free disk space. I rebooted the ESX Server just to be sure that it isn’t a temporary I don’t know ..failure or error. When I tried it again => still the same.
I found this article / post. But that didn’t help me either. I started looking at the different files in the folder
[root@vmdesx001 VMDSRV004]# ls -la
total 184550784
drwxr-xr-x 1 root root 1540 Oct 30 15:07 .
drwxr-xr-t 1 root root 2240 Oct 31 07:21 ..
-rw——- 1 root root 406 Oct 30 14:18 VMDSRV004_C.vmdk
-rw——- 1 root root 408 Oct 30 14:18 VMDSRV004_D.vmdk
-rw——- 1 root root 137438953472 Oct 30 14:24 VMDSRV004-flat.vmdk
-rw——- 1 root root 25769803776 Oct 30 14:24 VMDSRV004 NEW_1-flat.vmdk
-rw——- 1 root root 25769803776 Oct 30 14:24 VMDSRV004 NEW-flat.vmdk
-rw——- 1 root root 404 Oct 30 14:18 VMDSRV004.vmdk
-rw——- 1 root root 0 Oct 30 15:07 VMDSRV004.vmsd
-rwxr-xr-x 1 root root 1544 Oct 31 08:33 VMDSRV004.vmx
-rw——- 1 root root 264 Oct 31 08:33 VMDSRV004.vmxf
I checked the VMDSRV004_C.vmdk using cat.
[root@vmdesx001 VMDSRV004]# cat VMDSRV004_C.vmdk
# Disk DescriptorFile
version=1
CID=c010d074
parentCID=ffffffff
createType="vmfs"
# Extent description
RW 50331648 VMFS "VMDSRV004 NEW-flat.vmdk"
# The Disk Data Base
#DDB
ddb.virtualHWVersion = "4"
ddb.uuid = "60 00 C2 97 8f 60 80 19-1e 49 de 39 f4 48 9f 7d"
ddb.geometry.cylinders = "3133"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.adapterType = "lsilogic"
ddb.toolsVersion = "7300"
Ok, there’s an # Extent description Section in that file. AND, a Filename defined with a SPACE in it!
Let’s change the Filename on disk to something without a space
[root@vmdesx001 VMDSRV004]# mv "VMDSRV004 NEW-flat.vmdk" "VMDSRV004_NEW-flat.vmdk"
and now let’s open the VMDSRV004_C.vmdk using vi or nano or whatever editor.
[root@vmdesx001 VMDSRV004]# vi VMDSRV004_C.vmdk
change the section
# Extent description
RW 50331648 VMFS "VMDSRV004_NEW-flat.vmdk" <== new filename!
:wq (write quit the editor)
and try to extend the partition again..
[root@vmdesx001 VMDSRV004]# vmkfstools -X 48G VMDSRV004_C.vmdk
[root@vmdesx001 VMDSRV004]#
And see, IT WORKS. Took me 3 hours and thought I’ll share that with the rest of the world. maybe it will help someone .. someday.
ThanXX for ur efforts