There are certain instances where descriptor files, both base disk & snapshots, may get damaged, corrupted, or deleted. This KB will outline the following:
THE CONTENT OF THIS ARTICLE IS PROVIDED "AS-IS," AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, VMWARE BY BROADCOM DISCLAIMS ALL OTHER REPRESENTATIONS AND WARRANTIES, EXPRESSED OR IMPLIED, REGARDING THIS CONTENT, INCLUDING THEIR FITNESS FOR A PARTICULAR PURPOSE, THEIR MERCHANTABILITY, OR THEIR NONINFRINGEMENT. VMWARE BY BROADCOM SHALL NOT BE LIABLE FOR ANY DAMAGES ARISING OUT OF OR IN CONNECTION WITH THE USE OF THIS CONTENT, INCLUDING DIRECT, INDIRECT, CONSEQUENTIAL DAMAGES, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF VMWARE BY BROADCOM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This is for vSAN OSA ONLY and should NOT be used for vSAN ESA as Native Snapshots are handled differently and the descriptor files are not the same.
ENSURE TO READ THROUGH THE ENTIRE KB ENSURING YOU UNDERSTAND THE PROCESS BEFORE RECREATING MISSING OSA DESCRIPTOR FILES. IF YOU'RE UNSURE OF ANY STEPS OPEN A CASE WITH vSAN Support FOR ASSISTANCE.
VMware vSAN OSA (All Versions)
Log into the host that the VM is registered to and then run the following command:vim-cmd vmsvc/getallvms | grep <name of the VM> this should give you the following output.
Example:
[root@esxi_host:~] vim-cmd vmsvc/getallvms | grep Test-VM
1 Test-VM [vsanDatastore] 35873762-12ab-1ccc-acda-############/Test-VM.vmx
Once you have the path to the namespace cd to that namespace - You will need to be in the namespace of the VM for the remaining steps
Example:
[root@esxi_host:~] cd /vmfs/volumes/vsanDatastore/35873762-12ab-1ccc-acda-############
If the namespace doesn't exist create a new VM container with the exact settings used for the VM to create the missing namespace with no disks.
If there is a namespace for the VM and you only need to recreate new descriptor file(s) proceed to step 3.
esxcli vsan debug object list --all (for 7.x) or --max-number=<number higher than the objects in the environment>(for 8.x as there is a bug where --all doesn't work) > /tmp/debugObjList.txtcat /tmp/debugObjList.txt | grep "Object UUID\|Path" | awk '{printf $0}' | sed -e s"/Object UUID/\nObject UUID/g" | grep <vm-name> > /tmp/debug<vm-name>.txt
Example:cat /tmp/debugObjList.txt | grep "Object UUID\|Path" | awk '{printf $0}' | sed -e s"/Object UUID/\nObject UUID/g" | grep Test-VM > /tmp/debugTest-VM.txt
cat /tmp/debugTest-VM.txt
Object UUID: 7c883762-da93-2214-5a27-############ Path: /vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############/Test-VM-000001.vmdk (Exists)
Object UUID: 3c873762-b7d0-6c49-35dd-############ Path: /vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############/Test-VM.vmdk (Exists)
Object UUID: 35873762-12ab-1ccc-acda-############ Path: /vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/Test-VM (Exists)
/usr/lib/vmware/osfs/bin/objtool getAttr -u <object_UUID> |grep -E 'Object size|Object path' against the vSAN UUID object you need to create a new descriptor file for to ensure the Object attributes are referencing the proper vmdk descriptor path and to get the object size.Example:
/vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############] /usr/lib/vmware/osfs/bin/objtool getAttr -u 3c873762-b7d0-6c49-35dd-############ |grep -E 'Object size|Object path'
Object size:17179869184 <this is the info you will need for step 5>
Object path: /vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############/Test-VM.vmdk
(Please verify the object attribute (name) is the same as the object you need to create the new descriptor for)
# Disk DescriptorFile
version=4
encoding="UTF-8"
CID=43d91c46
parentCID=ffffffff
createType="vsan"
# Extent description
RW <Object Size from Step 4 /512 here> VMFS "vsan://<vsan datastore UUID from Object Path info from step 4 here>/Object UUID for the object of the descriptor file being recreated from step 3 here>"
#The Disk Data Base
#DDB
vi Test-VM.vmdkExample output:
# vmkfstools -qv10 Test-VM.vmdk
DISKLIB-VMFS : "vsan://523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############" : open successful (23) size = 17179869184, hd = 0. Type 3
./Test-VM.vmdk is not an rdm <== If you get here, you have passed the test!
DISKLIB-VMFS : "vsan://523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############" : closed.
AIOMGR-S : stat o=3 r=3 w=0 i=2 br=49152 bw=0
OBJLIB-LIB: ObjLib cleanup done.
WORKER: asyncOps=0 maxActiveOps=0 maxPending=0 maxCompleted=0
OR:
# vmkfstools -e Test-VM.vmdk
Disk chain is consistent.
# Disk DescriptorFile
version=4
encoding="UTF-8"
CID=fffffffe
parentCID=fffffffe
createType="vsanSparse"
parentFileNameHint="Test-VM.vmdk"
# Extent description
RW <Object Size from Step 4 /512 here> VMFS "vsan://<vsan datastore UUID from Object Path info from step 4 here>/Object UUID for the object of the descriptor file being recreated from step 3 here>"
#The Disk Data Base
#DDB
vi <vmname>-000001.vmdk/usr/lib/vmware/osfs/bin/objtool setAttr -u <Object UUID> -d <Path to VMDK>
Example:Another option is to use vmkfstools -c for recreating the base disk descriptor. This doesn't work for recreating snapshot/delta descriptor files. If you need to recreate snapshot descriptor files see the Resolution section above.
Below are the steps.
esxcli vsan debug object list --all (for 7.x) or --max-number=<number higher than the objects in the environment>(for 8.x as there is a bug where --all doesn't work) > /tmp/debugObjList.txtcat /tmp/debugObjList.txt | grep "Object UUID\|Path" | awk '{printf $0}' | sed -e s"/Object UUID/\nObject UUID/g" | grep <vm-name> > /tmp/debug<vm-name>.txt
Example:cat /tmp/debugObjList.txt | grep "Object UUID\|Path" | awk '{printf $0}' | sed -e s"/Object UUID/\nObject UUID/g" | grep Test-VM > /tmp/debugTest-VM.txt
cat /tmp/debugTest-VM.txt
Object UUID: 7c883762-da93-2214-5a27-############ Path: /vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############/Test-VM-000001.vmdk (Exists)
Object UUID: 3c873762-b7d0-6c49-35dd-############ Path: /vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############/Test-VM.vmdk (Exists)
Object UUID: 35873762-12ab-1ccc-acda-############ Path: /vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/Test-VM (Exists)
Run /usr/lib/vmware/osfs/bin/objtool getAttr -u <object_UUID> |grep -E 'Object size|Object path' against the vSAN UUID object you need to create a new descriptor file for to ensure the Object attributes are referencing the proper vmdk descriptor path and to get the object size.
Example:
/vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############] /usr/lib/vmware/osfs/bin/objtool getAttr -u 3c873762-b7d0-6c49-35dd-############ |grep -E 'Object size|Object path'
Object size:17179869184 <this is the info you will need for step 5>
Object path: /vmfs/volumes/vsan:523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############/Test-VM.vmdk
(Please verify the object attribute (name) is the same as the object you need to create the new descriptor for)
vmkfstools -c <Object size> VM_name.vmdk to create the new base disk descriptor fileExample output:
# vmkfstools -qv10 Test-VM.vmdk
DISKLIB-VMFS : "vsan://523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############" : open successful (23) size = 17179869184, hd = 0. Type 3
./Test-VM.vmdk is not an rdm <== If you get here, you have passed the test!
DISKLIB-VMFS : "vsan://523a45b14aa3d25e-3d06############/35873762-12ab-1ccc-acda-############" : closed.
AIOMGR-S : stat o=3 r=3 w=0 i=2 br=49152 bw=0
OBJLIB-LIB: ObjLib cleanup done.
WORKER: asyncOps=0 maxActiveOps=0 maxPending=0 maxCompleted=0
OR:
# vmkfstools -e Test-VM.vmdk
Disk chain is consistent.
vmkfstools -c <Object size> VM_name.vmdk was initially run/usr/lib/vmware/osfs/bin/objtool delete -u <object_UUID> to delete the object