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 which 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 section of the Configuration Guide for your version of VMware ESX.

This method is specific to the local console in ESX/ESXi. For other manual methods, see Managing vSphere Storage using the Command Line Interface (CLI) (1029301).


Environment

VMware ESXi 4.0.x Installable
VMware ESXi 4.1.x Installable
VMware ESX 4.1.x
VMware ESXi 3.5.x Embedded
VMware ESX Server 3.5.x
VMware ESX Server 1.x
VMware ESXi 4.0.x Embedded
VMware ESX Server 2.0.x
VMware ESXi 4.1.x Embedded
VMware ESX Server 3.0.x
VMware vSphere ESXi 5.0
VMware ESX 4.0.x
VMware ESXi 3.5.x Installable
VMware ESX Server 1.5.x

Resolution

To create a new VMFS volume from the ESX/ESXi host command line:
 
  • For ESXi/ESX 4.1 and later , use "partedUtil setptbl"

    partedUtil setptbl "/vmfs/devices/disks/DeviceName" DiskLabel ["partNum startSector endSector type/guid attribute"]*
     
  • For ESXi 3.x/4.x, use the fdisk command to create a new partition with a starting offset of 128 and type fb. For example: 
Run the command: fdisk /vmfs/devices/disks/naa.60901234567890123456789012345678
  1. Type p and press Enter to list partition information.
  2. Type d and press Enter to delete existing partition information.
  3. Type n and press Enter for new partition.
  4. Type p and press Enter for a primary partition.
  5. Type 1 and press Enter.
  6. For the First cylinder prompt, press Enter for the default.
  7. For last cylinder or +size, press Enter for the default.
  8. Type t and press Enter to change volume type.
  9. Type 1 and press Enter to select the first partition.
  10. Type fb and press Enter.
    • Note: fb is the hexadecimal code for VMFS volumes.
  11. Type x and press Enter to enter Expert mode.
  12. Type b and press Enter to start the process of changing the starting block of the partition.
  13. Type 1 and press Enter to select the first partition.
  14. Type 128 and press Enter to set the starting block to 128.
  15. Type w and press Enter to save the changes and exit fdisk.
  • Use the vmkfstools command to format the new partition as a VMFS-3 datastore, specifying a Block Size of 1-8MB, a friendly name for the datastore, and the chosen disk device and the created partition.

    vmkfstools -C vmfs3 -b BlockSize -S DatastoreVolumeName /vmfs/devices/disks/ DeviceName:Partition

    Usage:

    vmkfstools -C vmfs3 /vmfs/devices/disks/vml... or,
    vmkfstools -C vmfs3 /vmfs/devices/disks/naa... or,
    vmkfstools -C vmfs3 /vmfs/devices/disks/mpx.vmhbaA:T:L:P

    For example:

    vmkfstools -C vmfs3 -b 8m -S NewDatastore /vmfs/devices/disks/naa.60901234567890123456789012345678:1

    For ESXi 5.0 you can create a datastore with the VMFS-5 file system using the command:

    vmkfstools -C vmfs5 -b 1m -S NewDatastore /vmfs/devices/disks/naa.60901234567890123456789012345678:1

    Note: In a VMFS 5 file system, the recommended starting offset is 2048, instead of 128. This ensures to mitigate failures if the SCSI UNMAP command is used.
     
  • Rescan the storage subsystem to pick up the changes. The datastore should appear and be usable for virtual machine storage. For more information, see Performing a rescan of the storage on an ESX/ESXi host (1003988).


Additional Information



Unable to connect to an ESX host using Secure Shell (SSH)
Performing a rescan of the storage on an ESX/ESXi host
Identifying disks when working with VMware ESXi/ESX
Using Tech Support Mode in ESXi 4.1, ESXi 5.x, and ESXi 6.x
Managing Storage using the Command Line Interface (CLI) in vSphere 4.x
Using the partedUtil command line utility on ESXi and ESX
使用 vmkfstools -C 手动创建 VMFS 卷
vmkfstools -C を使用して手動で VMFS ボリュームを作成する