Create VMFS volumes from the command-line

I just had to create a couple VMFS volumes from the command-line on a local disk. It’s pretty straight forward but I needed to document it anyway, here it is:

  1. fdisk -l (check what the last partition is)
  2. fdisk /dev/sda
  3. n (new)
  4. default (start block)
  5. default (end block)
  6. t (partition type)
  7. 10 (partition 10, just created)
  8. fb (vmfs type)
  9. w (write config)
  10. reboot (Reboot the host before you format the newly created local partition)
  11. vmkfstools -C vmfs3 /vmfs/devices/disks/vmhba0:0:0:10
  12. Go to VI Client, Refresh storage view and rename the newly created volume
You can align the VMFS volume as follows, before you do step 9:
  1. X
  2. b
  3. 1
  4. 128 (disk alignment, check your SAN manual for the correct value, 128 is correct in most cases…)
  5. W
Be Sociable, Share!


    1. says

      you may want to mention that creating partitions from the cmdline requires manual aligning. vCenter does this for you but doing this with fdisk you have to set the startingblock of a parition to a multiple of 128 to align it on a 64k block.

    2. Hugo Strydom says

      Interesting, you only have to reboot if you add partions on /dev/sda. If create partions on /sdb,c,d, ect you dont need to.