Disk Consolidation Needed – Unable to access file since it is locked


If any backup running on your VM it will create a snapshot and after completion the snapshot will get removed. Sometimes it requires disk consolidation for the VM.

When we try to do disk consolidation of the VMDKs manually by right clicking on the VM and selecting Snapshot –> Consolidate.

However the consolidate operation may fail again, if the issue which caused the snapshot deletion operation to fail disk consolidation previously has not been cleared and shows an error “Unable to access file since it is locked”

VM-Consolidation1

 

 

VM-Consolidation-error1

 

I manually tried the scenarios like create another snapshot by switching off the VM and delete the snapshot manually for consolidation of VM disk and remove the VM from inventory and reregister the VM in the Vcenter which is also weird.

 

Solution:-

  1. From the VM summary identified the ESXI and do SSH login.

2. Ran the command “vmkfstools -D /vmfs/volumes/yourvolume/yourVM/yourlockedVM.vmdk

3. I could see the owner of the vmdk file which had the lock with MAC address ending “008ed

# vmkfstools -D /vmfs/volumes/VM_BLOCK_LUN0_VNX5200/VM server Folder/VM-

flat.vmdk

Lock [type 10c00001 offset 49518592 v 15, hb offset 3276800

gen 9, mode 1, owner 561795d7-66ffccd8-782c-b82a72d008ed mtime 797087

num 0 gblnum 0 gblgen 0 gblbrk 0]

Addr <4, 54, 3>, gen 4, links 1, type reg, flags 0, uid 0, gid 0, mode 600

len 107374182400, nb 102400 tbz 44371, cow 0, newSinceEpoch 102400, zla 3, bs 1048576

 

  1.  This is the ESXi server which has the lock on the VMDK file.
  2.  Next locate which ESXi host has a network adaptor with that MAC address.

 

  1.  Once confirmed I placed the host in maintenance mode, DRS vMotioned all VMs to another host in the cluster and restarted the hostd service or restart the server.

Syntax: #/etc/init.d/hostd restart

7. After restarting the host I can able to do consolidation of disk successfully and also storage migration.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: