Recover VMFS datastore with all data

Sometimes it might happen that you lost datastore with all date for some reasons, deleted by mistake, VMFS corruption. It happen to me as well. Fortunately, following VMwareKB article I was able to recover VMFS with all data.

[box type=”warning”] The most important – DO NOT PANIC !! 🙂 and DO NOT create VMFS on that LUN because it will overwrite old partition table[/box]

 Recover VMFS3 datastore

To recover VMFS3 volumes or upgraded VMFS5 from VMFS3 (without formatting) we will use old good toll fdisk :-).

  • type esxcfg-scsidev -c list LUNs and identify Console device /dev/sd* , in my example it is /dev/sdg with size 507940 MB
  • type fdisk -l /dev/sd* (replace * with correct letter) to see info about device – you should not see partition table.
  • type fdisk -u /dev/sd* (replace * with correct letter) and follow below steps:
    • type n – create new partition
    • type p – for primary
    • type 1 – for first partition on disk
    • type 128 – this is starting block for VMFS which was created using vSphere client
    • press Enter – to leave default values for last sector
    • press t – select partition type
      • optionally you can type L to list all partition types
    • type fb for VMware VMFS file system
    • type w to write partition on disk

  • Run vmkstools -V to discover VMFS back to system

  • Check log  /var/log/messages . As you can kernel see new partition sdg1 which sits on /dev/sdg device . Mission complete successfully.

You should see datastore with new name on ESX server. Rescan HBA on all other servers to bring VMFS back on them.

[button link=”″ color=”purple”] VMwareKB article 1002281[/button]


Artur Krzywdzinski

Artur is Consulting Architect at Nutanix. He has been using, designing and deploying VMware based solutions since 2005 and Microsoft since 2012. He specialize in designing and implementing private and hybrid cloud solution based on VMware and Microsoft software stacks, datacenter migrations and transformation, disaster avoidance. Artur has been in IT industry since 1999 and consulting since 2008. Artur holds VMware Certified Design Expert certification (VCDX #077).

  • manish

    I will suggest to engage VMware Support if you suspect there is a corruption on the VMFS volume.

    • this what people should do on a first place, however there might be a situation when quick action is required or the infrastructure is out of the maintenance contract with VMware

  • DH

    Can you provide any guidance on a LUN that was connected as a drive for a VM that was accidentally attached as a datastore instead of a Mapped LUN?

    • not sure if I understand, so you had RDM device attached to VM and afterword someone formatted that LUN as VMFS datastore ?

      • Vaibhav

        Hey Arthur , if this is the case an RDM disc was added as an extent to a VMFS volume. can the data be recovered in any case?

  • Pingback: Recovery Data Fd()

  • Curt Hall

    i know its been a year, but this happened to me today 🙁

    when i do the esxcfg-scsidevs -c my orphaned volume shows blank for “Console Device” so i cannot perform any of the above processes its always “not found”, I am using ESXi5.5 and tried partedUtil and it doesn’t “see” it either. but it does show under esxcfg-scsidevs- c, it just has no name under “Console Device”.

  • I’ve worked with VMware support before, back when I had a contract, on an external datastore that became corrupt after a PSOD. Indeed, they can perform miracles.

    By the way, if a VMFS5 drive was accidentally left in place during a new Nutanix CE install (which automatically formats all drives without pausing or on-screen warning), do you happen to know of some way to essentially unformat it, and/or get any of the data (some VMs) back off that drive?