Recovery of Locked VMDK

Publié par Tpeltier le

This guide explains a recovery procedure for a locked VMDK file under ESX 3.0.x. Although out of the ordinary, this problem can prevent a VM from booting which makes it particularly nasty.

Log excerpts from vmware.log describing the problem…

Sep 24 08:41:03.048: vmx| DISKLIB-DSCPTR: Failed to open extents for descriptor file in normal mode
Sep 24 08:41:03.049: vmx| DISKLIB-LINK  :
 "/vmfs/volumes/454a6c04-cc731970-4ded-000423c460a7/LUVM21/LUVM21.vmdk" :
 failed to open (Device or resource busy).
Sep 24 08:41:03.049: vmx| DISKLIB-CHAIN :
 "/vmfs/volumes/454a6c04-cc731970-4ded-000423c460a7/LUVM21/LUVM21.vmdk" :
 failed to open (Device or resource busy).
Sep 24 08:41:03.049: vmx| DISKLIB-LIB   : Failed to open
 '/vmfs/volumes/45e781ce-df97e708-4ea4-00145e1c0f80/MYVM/MYVM.vmdk' with 
 flags 0xa (Device or resource busy).
Sep 24 08:41:03.049: vmx| DISK: Cannot open disk
 "/vmfs/volumes/45e781ce-df97e708-4ea4-00145e1c0f80/MYVM/MYVM.vmdk":
 Device or resource busy (1048585).
Sep 24 08:41:03.049: vmx| DISK: Failed to open disk
 '/vmfs/volumes/45e781ce-df97e708-4ea4-00145e1c0f80/MYVM/MYVM.vmdk' :
 Device or resource busy (1048585) 3191
Sep 24 08:41:03.049: vmx| Msg_Post: Error
Sep 24 08:41:03.049: vmx| [msg.disk.noBackEnd] Cannot open the disk
 '/vmfs/volumes/45e781ce-df97e708-4ea4-00145e1c0f80/MYVM/MYVM.vmdk' or one of the
 snapshot disks it depends on.
Sep 24 08:41:03.049: vmx| [msg.disk.configureDiskError] Reason: Device or resource busy.
Sep 24 08:41:03.077: vmx| Module DiskEarly power on failed.


Procedure

We will use vcbExport to pull the data out of the locked VMDK into a fresh unlocked VMDK. Change MYVM to match your VM’s name.

export VMNAME=MYVM

Find the folder where it lives

ls /vmfs/volumes/*/$VMNAME/$VMNAME.vmx
/vmfs/volumes/45e781ce-df97e708-4ea4-00145e1c0f80/MYVM/MYVM.vmx
/vmfs/volumes/SAN8/MYVM/MYVM.vmx

Move the old VM folder out of the way, create anew

cd /vmfs/volumes/SAN8/
mv $VMNAME $VMNAME.old
mkdir $VMNAME
cd $VMNAME
time /usr/sbin/vcbExport -M 1 -F 1 -d $VMNAME.vmdk -s ../$VMNAME.old/$VMNAME.vmdk

Expect to wait awhile, this took me 10m for a 12G virtual disk. YMMV.

If there are additional virtual disks, now is the time to convert them also, i.e.,

time /usr/sbin/vcbExport -M 1 -F 1 -d ${VMNAME}_1.vmdk -s ../${VMNAME}.old/${VMNAME}_1.vmdk

Now tweek resulting MYVM.vmdk (hope you know vi)…and perhaps also MYVM_1.vmdk. But not the ones with ‘-flat’ in their names.

createType="monolithicFlat"

becomes

createType="vmfs"

and

RW 25165824 FLAT "MYVM-flat.vmdk" 0

becomes

RW 25165824 VMFS "MYVM-flat.vmdk"

Restore .vmx and .vmxf file

cp ../$VNMAME.old/$VMNAME.vmx* .

Register VM with the host

vmware-cmd -s register `pwd`/$VMNAME.vmx
register(/vmfs/volumes/45e781ce-df97e708-4ea4-00145e1c0f80/MYVM/MYVM.vmx) = 1

Start the VM

vmware-cmd `pwd`/$VMNAME.vmx start
start() = 1

Answer the inevitable UUID question (KEEP)

vmware-cmd `pwd`/$VMNAME.vmx answer

Check the state, it should be on

vmware-cmd `pwd`/$VMNAME.vmx getstate
getstate() = on
Catégories : Vmware

0 commentaire

Laisser un commentaire

Emplacement de l’avatar

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.