VMware Cloud Community
PortableTechHF
Contributor
Contributor
Jump to solution

Finding VMs that need concilidation and have locked files

All,

Somtimes our backup software manages to not properly unlock a file after it does a backup and we wind up with an error showing that concilidation is needed as well as a Task Entry with the following details

Name: Consolidate virtual machine disk files

Status: Unable to accesssfile since it is locked

Details (View Details):

     An error occurred while consolidating disks: msg.fileio.lock.

     Consolidation failed for disk node 'scsi0:1': msg.fileio.lock.

When these occur, it is simple for my backup person to address, I am just trying to determine how I can automate finding them.  I can use the Get-VIEvent command to find references to the Task Event Name field without issue, what I can not seem to determine is how I can additionally extract the Status and/or the Details field which would help me determine if it was a failure as a result of this issue or not as Get-VIEvent does not seem to show that data.

0 Kudos
1 Solution

Accepted Solutions
PortableTechHF
Contributor
Contributor
Jump to solution

Answered my own question after thinking it through more, thought I would share in case anyone else ever needed it.

$start = (Get-Date).AddDays(-1)

Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) | where {$_.Fault.LocalizedMessage -like "Unable to access file  since it is locked"} | Select CreatedTime,@{N="Host";E={$_.Host.Name}},ObjectName,UserName,@{N="Fault";E={$_.Fault.Fault}},@{N="FaultMessage";E={$_.Fault.LocalizedMessage}}

View solution in original post

0 Kudos
1 Reply
PortableTechHF
Contributor
Contributor
Jump to solution

Answered my own question after thinking it through more, thought I would share in case anyone else ever needed it.

$start = (Get-Date).AddDays(-1)

Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) | where {$_.Fault.LocalizedMessage -like "Unable to access file  since it is locked"} | Select CreatedTime,@{N="Host";E={$_.Host.Name}},ObjectName,UserName,@{N="Fault";E={$_.Fault.Fault}},@{N="FaultMessage";E={$_.Fault.LocalizedMessage}}

0 Kudos