I’ve had my share of battles with corrupt vmdk files, after the process of removing a snapshot crashed. Finally, I found a way to recover them through a VCB utility. Here’s the log that usually presents itself:
May 12 01:43:13.593: vmx| DISKLIB-DSCPTR: Failed to open extents for descriptor file in normal mode
May 12 01:43:13.593: vmx| DISKLIB-LINK : “/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk” : failed to open (Device or resource busy).
May 12 01:43:13.593: vmx| DISKLIB-CHAIN : “/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk” : failed to open (Device or resource busy).
May 12 01:43:13.594: vmx| DISKLIB-LIB : Failed to open ‘/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk’ with flags 0xa (Device or resource busy).
May 12 01:43:13.594: vmx| DISK: Cannot open disk “/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk”: Device or resource busy (1048585).
May 12 01:43:13.594: vmx| Msg_Post: Error
May 12 01:43:13.594: vmx| [msg.disk.noBackEnd] Cannot open the disk ‘/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk’ or one of the snapshot disks i
t depends on.
May 12 01:43:13.594: vmx| [msg.disk.configureDiskError] Reason: Device or resource busy.
We will use the vcbExport utility to read the data from the old vmdk and create a new one.
First, unregister the VM from your ESX host (if not done already):
# cd /vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/
# vmware-cmd -s unregister `pwd`/VM1/VM1.vmx
unregister(/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmx) = 1
Then move the old VM directory and create a new one:
# mv VM1 VM1.old
# mkdir VM1
# cd VM1
Then, convert the old vmdk to a new one:
# vcbExport -M 1 -F 1 -d VM1.vmdk -s ../VM1.old/VM1.vmdk
This will take a while, depending on the size of your disks. After all, it is copying the entire data file. Do the same for the other vmdk’s, if you have more than one disk.
After you finish with vcbExport, we need to alter a few things to the .vmdk file(s); open it in your favorite editor.
Change:
createType=”monolithicFlat”
To:
createType=”vmfs”
Change:
RW 56124534 FLAT “VM1-flat.vmdk” 0
To:
RW 56124534 VMFS “VM1-flat.vmdk”
Copy .vmx and .vmxf file
# cp ../VM1.old/VM1.vmx* .
After that, you can register and start the VM again:
# vmware-cmd -s register VM1.vmx
register(/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmx) = 1
# vmware-cmd VM1.vmx start
start() = 1
The VM will require an answer on the UUID matter (choose ‘Keep’) before it actually boots:
# vmware-cmd VM1.vmx answer
Leave a Reply