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=”http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002281″ 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 holds VMware Certified Design Expert certification (VCDX #077).