Manually creating a VMFS volume using vmkfstools -C
search cancel

Manually creating a VMFS volume using vmkfstools -C

book

Article ID: 309687

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides steps to create a new VMFS volume on a disk that has free, unallocated space.

Note: VMFS Datastores are normally created using the vSphere Client, and it is not necessary to format the disk from the command line. For more information, see the Create VMFS Datastores.

Environment

VMware vSphere ESXi 8.0

VMware vSphere ESXi 7.0

Resolution

To create a new VMFS volume from the ESX/ESXi host command line:
 

  • Rescan the storage subsystem to ensure that the host is updated with the latest storage information. For more information, see Performing a rescan of the storage on an ESXi host
     
  • Open a console to the ESXi host. For more information, see Using ESXi Shell in ESXi
     
  • Select a LUN or storage device you wish to format by its /vmfs/devices/disks/... identifier, starting with vml, naa, mpx, or vmhba. For more information, see Identifying disks when working with VMware ESXi 

  • Use the partedUtil command to print any existing partitions defined on the chosen disk device. For more information, see Using partedUtil command line disk partitioning utility on ESXi

    Caution: Before proceeding, take backups, as using the utility may result in data loss for modified disks/partitions. 

  • Use the "partedUtil" command to create a new partition:
      • partedUtil setptbl "/vmfs/devices/disks/DeviceName" DiskLabel ["partNum startSector endSector type/guid attribute"]
    • Example:
      • ​​​​​​​​​partedUtil setptbl /vmfs/devices/disks/DeviceName gpt "1 2048 7516192734 AA31E02A400F11DB9590000C2911D1B8 0"
  • Use the vmkfstools command to format the new partition as a VMFS-5/VMFS-6 datastore, a friendly name for the datastore, and the chosen disk device and the created partition.

    You can create a datastore with the VMFS-5/VMFS-6 file system using the command:
    • vmkfstools -C vmfs5 -S <NewDatastore> /vmfs/devices/disks/naa.6090123456xxx:1

Note: The recommended starting offset in a VMFS-5/VMFS-6 file system is 2048. This mitigates failures if the SCSI UNMAP command is used.