Increase datastore capacity by adding an extent via CLI
search cancel

Increase datastore capacity by adding an extent via CLI

book

Article ID: 418647

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Sometimes, it may be required for you to increase datastore capacity by adding an extent via CLI when the host UI is not reachable.

Current usage on the datastores
[root@localhost:~] df -h
Filesystem   Size   Used Available Use% Mounted on
VMFS-6     319.0G   1.4G    317.6G   0% /vmfs/volumes/Datastore-Name1
VMFS-6      14.0T  14.0T      1.6G 100% /vmfs/volumes/Datastore-Name2
VMFS-L     119.8G  10.5G    109.3G   9% /vmfs/volumes/OSDATA-########-########-####-############
vfat         4.0G 211.2M      3.8G   5% /vmfs/volumes/BOOTBANK1
vfat         4.0G 219.7M      3.8G   5% /vmfs/volumes/BOOTBANK2

Environment

ESXi
VMFS

Resolution

Take the following steps to increase the capacity of the datastore by adding an extent via CLI

  1. Identify naa/eui/t10 ID of the datastore. In this output, its naa.####################1
    [root@localhost:~] localcli storage vmfs extent list
    Volume Name                                 VMFS UUID                            Extent Number  Device Name                    Partition
    ------------------------------------------  -----------------------------------  -------------  -----------------------------  ---------
    datastore1 (3)                              68######-########-####-##########fc              0  naa.#####################          8
    Datastore-01                                68######-########-####-##########fc              0  naa.####################1          1
    OSDATA-########-########-####-############  68######-########-####-##########fc              0  naa.#####################          7

  2. List naa/eui/t10 ID of all the LUNs. In this output, we want to use naa.####################2 as an extent to increase the size of the datastore Datastore-01
    [root@localhost:~] esxcfg-scsidevs -c
    Device UID                         Device Type      Console Device                                        Size          Multipath Plugin    Display Name
    naa.#####################          Direct-Access    /vmfs/devices/disks/naa.#####################        14651290MB     NMP                 PURE Fibre Channel Disk (naa.#####################)
    naa.####################1          Direct-Access    /vmfs/devices/disks/naa.####################1        14651290MB     NMP                 PURE Fibre Channel Disk (naa.####################1)
    naa.####################2          Direct-Access    /vmfs/devices/disks/naa.####################2        14651290MB     NMP                 PURE Fibre Channel Disk (naa.####################2)

  3. Verify that a partition table does not exist on the device naa.####################2
    [root@localhost:/var/log] partedUtil getptbl /vmfs/devices/disks//vmfs/devices/disks/naa.####################2
    unknown
    1867777 255 63 30005842608

    If a partition table does exist, remove the partitions
    partedUtil delete "/vmfs/devices/disks/naa.####################2" 1
    Change the partition number in the above command as necessary and remove them. Then, follow step 5 to overwrite the partition and create a VMFS partition.

  4. Check the VMFS partition number on the current datastore. In this output, we may see that its 1
    [root@localhost:~] partedUtil getptbl /vmfs/devices/disks/naa.####################1
    gpt
    1867777 255 63 30005842608
    1 2048 30005841919 AA31E02A400F11DB9590000C2911D1B8 vmfs 0

  5. Create the partition table and vmfs partition on the new disk

    Get usable sectors
    [root@localhost:~] partedUtil getUsableSectors /vmfs/devices/disks/naa.####################2
    34 30005842574

    Create partition table and the vmfs partition on it
    [root@localhost:~] partedUtil setptbl /vmfs/devices/disks/naa.####################2 gpt "1 2048 30005842573 AA31E02A400F11DB9590000C2911D1B8 0"
    gpt
    0 0 0 0
    1 2048 30005842574 AA31E02A400F11DB9590000C2911D1B8 0
    Note: Set the ending sector as last usable sector minus. In this case, its 30005842574 -1 = 30005842573

  6. Add the extent to the datastore
    [root@localhost:~] vmkfstools -Z /vmfs/devices/disks/naa.####################2:1 /vmfs/devices/disks/naa.####################1:1
    VMware ESXi Question:
    All data on /vmfs/devices/disks/t10.########################:1 will be lost. Continue and format?
    0) _Yes
    1) _No
    Select a number from 0-1: 0
    Successfully spanned volume
    Note: Note that in this command, the extent is specified first and the original LUN is specifed after

  7. Perform a  rescan on the adapters and VMFS
    [root@localhost:~] localcli storage core adapter rescan --all
    [root@localhost:~] vmkfstools -V
    [root@localhost:~] 

  8. Confirm that the datastore size of Datastore-01 has increased
    [root@localhost:~] df -h
    Filesystem   Size   Used Available Use% Mounted on
    VMFS-6     319.0G   1.4G    317.6G   0% /vmfs/volumes/Datastore-Name1
    VMFS-6      27.9T  14.0T     14.0T  50% /vmfs/volumes/Datastore-Name2
    VMFS-L     119.8G  10.5G    109.3G   9% /vmfs/volumes/OSDATA-########-########-####-############
    vfat         4.0G 211.2M      3.8G   5% /vmfs/volumes/BOOTBANK1
    vfat         4.0G 219.7M      3.8G   5% /vmfs/volumes/BOOTBANK2



Additional Information

An attempt to add the LUN as extent without creating the partition table and the VMFS partition, will fail with the following message:
[root@localhost:~] vmkfstools -Z /vmfs/devices/disks/naa.####################2:1 /vmfs/devices/disks/naa.####################1:1
Device path name "/vmfs/devices/disks/naa.####################2:1" is not a valid absolute or relative path
Failed to resolve volume device path naa.####################2:1.
Usage: vmkfstools -Z span-partition
Error: No such file or directory