In this article by Abhilash G B, author of VMware vSphere 5.5 Cookbook, we will learn how to expand or grow a VMFS datastore with the help of two methods: using the Increase Datastore Capacity wizard and using the ESXi CLI tool vmkfstools.
(For more resources related to this topic, see here.)
Expanding/growing a VMFS datastore
It is likely that you would run out of free space on a VMFS volume over time as you end up deploying more and more VMs on it, especially in a growing environment. Fortunately, accommodating additional free space on a VMFS volume is possible. However, this requires that the LUN either has free space left on it or it has been expanded/resized in the storage array.
The procedure to resize/expand the LUN in the storage array differs from vendor to vendor, we assume that the LUN either has free space on it or has already been expanded.
The following flowchart provides a high-level overview of the procedure:
How to do it…
We can expand a VMFS datastore using two methods:
- Using the Increase Datastore Capacity wizard
- Using the ESXi CLI tool vmkfstools
Before attempting to grow the VMFS datastore, issue a rescan on the HBAs to ensure that the ESXi sees the increased size of the LUN.
Also, make note of the NAA ID, LUN number, and the size of the LUN backing the VMFS datastore that you are trying to expand/grow.
Using the Increase Datastore Capacity wizard
We will go through the following process to expand an existing VMFS datastore using the vSphere Web Client’s GUI.
- Use the vSphere Web Client to connect to vCenter Server.
- Navigate to Home | Storage.
- With the data center object selected, navigate to Related Objects | Datastores:
- Right-click on the datastore you intend to expand and click on Increase Datastore Capacity…:
- Select the LUN backing the datastore and click on Next:
- Use the Partition Configuration drop-down menu to select the free space left in DS01 to expand the datastore:
- On the Ready to Complete screen, review the information and click on Finish to expand the datastore:
Using the ESXi CLI tool vmkfstools
A VMFS volume can also be expanded using the vmkfstools tool. As with the use of any command-line tool, it can sometimes become difficult to remember the process if you are not doing it often enough to know it like the back of your hand.
Hence, I have devised the following flowchart to provide an overview of the command-line steps that needs to be taken to expand a VMFS volume:
Now that we know what the order of the steps would be from the flowchart, let’s delve right into the procedure:
- Identify the datastore you want to expand using the following command, and make a note of the corresponding NAA ID:
esxcli storage vmfs extent list
Here, the NAA ID corresponding to the DS01 datastore is naa.6000eb30adde4c1b0000000000000083.
- Verify if the ESXi sees the new size of the LUN backing the datastore by issuing the following command:
esxcli storage core device list -d naa.6000eb30adde4c1b0000000000000083
- Get the current partition table information using the following command:Syntax:
partedUtil getptbl "Devfs Path of the device"
Command:
partedUtil getptbl /vmfs/devices/disks/ naa.6000eb30adde4c1b0000000000000083
- Calculate the new last sector value. Moving the last sector value closer to the total sector value is necessary in order to use additional space.The formula to calculate the last sector value is as follows:
(Total number of sectors) – (Start sector value) = Last sector value
So, the last sector value to be used is as follows:
(31457280 – 2048) = 31455232
- Resize the VMFS partition by issuing the following command:Syntax:
partedUtil resize "Devfs Path" PartitionNumber NewStartingSector NewEndingSector
Command:
partedUtil resize /vmfs/devices/disks/ naa.6000eb30adde4c1b0000000000000083 1 2048 31455232
- Issue the following command to grow the VMFS filesystem:Command syntax:
vmkfstools –-growfs <Devfs Path: Partition Number> <Same Devfs Path: Partition Number>
Command:
vmkfstools --growfs /vmfs/devices/disks/ naa.6000eb30adde4c1b0000000000000083:1 /vmfs/devices/disks/ naa.6000eb30adde4c1b0000000000000083:1
Once the command is executed successfully, it will take you back to the root prompt. There is no on-screen output for this command.
How it works…
Expanding a VMFS datastore refers to the act of increasing its size within its own extent. This is possible only if there is free space available immediately after the extent. The maximum size of a LUN is 64 TB, so the maximum size of a VMFS volume is also 64 TB.
The virtual machines hosted on this VMFS datastore can continue to be in the power-on state while this task is being accomplished.
Summary
This article walks you through the process of creating and managing VMFS datastores.
Resources for Article:
Further resources on this subject:
- Introduction Vsphere Distributed Switches? [article]
- Introduction Vmware Horizon Mirage [article]
- Backups Vmware View Infrastructure [article]