Today our storage admin was adding some disks to our backup media server and he accidentally initialized a VMFS datastore from the windows box. Needless to say, this made us lose a bunch of VM’s. In my case, the data was unrecoverable. We are restoring from tape. But if you’re lucky and the VMFS partition hasn’t been formatted you can recover it.
To see if the partition type has changed:
1. Connect to an ESX host with access to the LUN as root.
2. Run “fdisk -lu” and locate the lun in question by the identifier. I had the ID ahead of time and was easier for me to do “fdisk -lu | grep lunid”
3. Look under the System column and it will tell you the partition type. If it is SFS that means it has been initialized by a windows machine.
4. Run “fdisk /dev/lunid”
5. Enter p to print the partition table and verify you have the right disk.
6. Enter t to set the type and enter fb as the type when prompted.
7. Enter w to write changes to the disk.
You may still have an issue with the block alignment being mangled by windows. To fix this:
1. Run “fdisk /dev/lunid”
2. Enter x for expert mode
3. Enter b for block alignment.
4. Enter 128 where prompted for the block alignment VMware expects.
5. Enter w to write changes to the disk.
After this, an esxcfg-rescan vmhba1 should make your datastore show back up. If not, hope you have good backups.