It is 2:15 AM. Your phone rings relentlessly with alerts from Zabbix: the datastore hosting your production Oracle and PostgreSQL clusters is flashing red as free space drops below 2%. You rush to open the SAN storage portal and increase the LUN capacity from 2 TB to 3.5 TB. But when you switch back to the vSphere Client, the VMFS datastore remains stuck at its old size. A few virtual machines begin pausing because there is no space left to write data. It is a nightmare scenario every on-call sysadmin has sweat through at least once, but one that can be mitigated if you automate daily vSphere health checks.
Emergency Fix: Resolving a Full Datastore in 3 Minutes
If your system is on the brink of collapse and VMs are starting to freeze, perform these three quick steps in the vSphere Client:
- Rescan Storage: Right-click the cluster or each ESXi host > select Storage > Rescan Storage… > Check both Scan for new Storage Devices and Scan for new VMFS Volumes > click OK. Wait until the rescan task completes 100%.
- Open the expansion wizard: Navigate to the Datastores tab > right-click the datastore running out of space > select Increase Datastore Capacity.
- Select the correct LUN and partition: vCenter will display the LUN with the newly expanded unallocated capacity from the SAN. Select that LUN > click Next > Under Partition Configuration, make sure to select Expand an existing VMFS datastore extent > drag the capacity slider to maximum (100%) > click Next > Finish.
Within roughly 10 to 30 seconds, the datastore will expand to 3.5 TB. Any paused VMs will automatically resume normal operations without requiring a reboot.
Under the Hood: ESXi Storage Stack Internals
Why doesn’t ESXi immediately recognize the new capacity after you expand a LUN on your SAN (such as a Dell PowerStore 1000T, HPE Nimble HF20, or NetApp AFF)? The answer lies in the SCSI communication mechanism between the host and the storage array.
When you modify the LUN configuration on the SAN, the storage array only updates metadata at the physical block layer. The ESXi host, connected via Fibre Channel (16/32 Gbps FC) or 10GbE iSCSI, maintains a local device mapping table. Until the host issues a SCSI READ CAPACITY (16) command via the HBA, the VMkernel continues to assume the LUN remains at its previous capacity.
In practice, expanding a VMFS datastore involves three distinct layers:
- Layer 1 – SCSI Device: The host detects the updated total sector count of the LUN after you trigger a storage rescan.
- Layer 2 – Partition Table: The GPT partition table is updated to reflect the new unallocated space at the end of the disk.
- Layer 3 – VMFS Filesystem: The VMFS filesystem structure expands across the enlarged partition without interrupting active I/O streams on running
.vmdkfiles.
A Critical Trap: Expand Extent vs. Add Extent
In the Increase Datastore Capacity wizard, VMware presents two options that are easy to confuse:
- Expand an existing VMFS datastore extent: Expands the existing LUN itself. This is the correct, safe, and recommended option.
- Add extent to existing VMFS datastore: Spans an entirely new LUN into the datastore to pool capacity (a spanning mechanism similar to JBOD).
Clicking Add extent by mistake in a half-asleep state at midnight is a recipe for disaster. The datastore then becomes dependent on two separate physical LUNs. If either LUN suffers a broken fiber link or a storage controller failure, the entire datastore crashes immediately. The chances of recovering your data at that point are extremely slim.
CLI Recovery on ESXi When the Web Client Hangs
When a datastore reaches 100% capacity, vCenter Server services often fail or the ESXi Host Client interface spins indefinitely. In this situation, your only lifeline is to SSH directly into the ESXi host and resolve it via the command line using ESXCLI.
Enable SSH via the physical DCUI console or your remote management interface (iDRAC/iLO), then run the following commands:
Step 1: Retrieve the NAA ID of the Affected LUN
# Check the list of datastores and UUIDs
esxcli storage filesystem list
# Sample output:
# Mount Point Volume Name UUID Mounted Type Size Free
# /vmfs/volumes/64a2f1c8-2b4a8e02-91ef-002590eb1234 DS_DB_PROD 64a2f1c8-2b4a8e02-91ef-002590eb1234 true VMFS-6 2198754820096 104857600
Find the storage device NAA ID corresponding to DS_DB_PROD:
esxcli storage vmfs extent list
# Get the corresponding Device Name, for example: naa.6000d31000028e000000000000000045
Step 2: Rescan Adapters and Verify New Capacity
# Force the host to rescan all HBAs and storage channels
esxcli storage core adapter rescan --all
# Check the new total usable sectors from the SAN
partedUtil getusableSectors /vmfs/devices/disks/naa.6000d31000028e000000000000000045
Step 3: Fix GPT Header Mismatch and Resize the Partition
When a LUN is expanded, the secondary GPT partition table (backup GPT header) located at the end of the disk becomes misaligned. Run the following command to move it to the actual last sector:
# Fix misaligned GPT header
partedUtil fixGpt /vmfs/devices/disks/naa.6000d31000028e000000000000000045
# Read the current partition table
partedUtil getptbl /vmfs/devices/disks/naa.6000d31000028e000000000000000045
# Sample output:
# gpt
# 456789 255 63 7338786816
# 1 2048 4294965247 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
Note the partition number (typically 1), the starting sector (2048), and the ending usable sector obtained from the getusableSectors output in Step 2 (e.g., 7338786782). Perform the partition resize:
# Syntax: partedUtil resize <Device> <Partition_ID> <Start_Sector> <End_Sector>
partedUtil resize /vmfs/devices/disks/naa.6000d31000028e000000000000000045 1 2048 7338786782
Step 4: Expand the VMFS Filesystem Online
This is the final step to allow the filesystem to recognize the newly expanded space without unmounting the volume:
# Syntax: vmkfstools --growfs <Device:Partition> <Device:Partition>
vmkfstools --growfs /vmfs/devices/disks/naa.6000d31000028e000000000000000045:1 /vmfs/devices/disks/naa.6000d31000028e000000000000000045:1
Run df -h | grep DS_DB_PROD to verify the results. The free capacity will immediately reflect the additional 1.5 TB. To avoid facing another capacity crisis in the future, you should also ensure you regularly reclaim storage space on VMware ESXi using UNMAP.
Field Experience: Avoiding Costly Mistakes During Late-Night Outages
- Check for orphaned snapshots (Consolidation Needed): Before expanding, verify whether any VM is holding onto a massive snapshot hundreds of gigabytes in size. If a virtual machine holds an aggressive lock on a VMDK, the host will take significantly longer to lock VMFS metadata.
- Synchronize across remaining cluster hosts: Once finished on Host 1, Host 2 and Host 3 in your HA/DRS cluster may still report the old capacity. Proactively trigger a Rescan Storage across the entire cluster so vCenter synchronizes the metadata cluster-wide.
- Monitor multipathing health: Before initiating a rescan, verify whether any FC path is marked Dead. Issuing a rescan against an HBA port experiencing optical signal degradation can freeze the SCSI queue for 30 to 60 seconds, introducing I/O latency across all co-located virtual machines.
- Never run services.sh restart during an active expansion: If the vCenter progress bar appears slow, resist the urge to restart ESXi management agents. Terminating processes while the kernel is actively writing the filesystem descriptor can easily corrupt the partition table.