fix-vm-snapshot-in-vmware-vsphere-when-file-lock-cannot-be-released

[row narrowcontent="true" padding="both" paddingtype="small" animation="fadeInUp"]

Fix VM snapshot in VMware vSphere when file lock cannot be released

Finding VMware snapshots can already be a nasty and difficult task as some of these hidden or just hard to find as the vSphere environment is pretty large. Therefore it’s important to have scripts, reports and tools like Snapwatcher or opvizor Health Analyzer to get an idea about the current situation in your environment.

That is actually the first step – know about your situation!

But the next step is to delete the Snapshots and one of the meanest situations are locked files that stop you from doing so.#

There are many different kinds of locking mechanism VMware vSphere uses and I want to start our fix VM snapshot series with a real tough one.

Given VM Snapshot situation

In this case it doesn´t matter if the VM snapshot is inconsistent or not, the message you receive when running either Snapshot remove or Snapshot consolidate is a short and simple file is locked.

Unfortunately the VM can be "powered on", "powered off" and no locked file can be found. Actually when the customer approached us with that situation we thought of a Snapwatcher bug during beta. But the story will end with a VMware bug, that is absolutely weird but luckily easy to fix. But the investigation is before the fix, so let´s start with that first.

fix VMware snapshot - fix VM snapshot

Like mentioned before the VM is powered off and the file lock message pops up when trying to delete the snapshots. When checking the VM and creating new snapshots, all works well. Strange enough, also a power on works fine. Normally you would expect a locked file message also when starting the VM.

VM snapshot consolidation

When checking the virtual machine log file vmware.log in the home directory of the VM, the following entry can be found:

2015-03-05T20:08:25.112Z| vcpu-0| I120: AIOGNRC: Failed to open '/vmfs/volumes/0025909bfda0/WinVM/WinVM-flat.vmdk' : Failed to lock the file (40003) (0x2013). 2015-03-05T20:08:25.112Z| vcpu-0| I120: AIOMGR: AIOMgr_OpenWithRetry: Descriptor file '/vmfs/volumes/0025909bfda0/WinVM/WinVM-flat.vmdk' locked (try 0)

When checking the Snapwatcher log that automatically initiates Snapshot deletion and Snapshot Consolidate the following message is found showing that is was not succesful to fix VM snapshot:

2015-03-05 12:11:59,598 [1] INFO VMSnapshot [(null)] - Attempt to consolidate VM disks... 2015-03-05 12:12:04,057 [1] INFO VMSnapshot [(null)] - Unable to access file since it is locked

Looking at the typical patterns within the datastore all -flat.vmdk files of the base disks are there and a dozen of -delta.vmdk files showing the different snapshots made. As a backup software was running there are a couple of snapshot files there but not all show up as the base disk is pretending to be locked so many broken or inconsistent snapshot are the result.

Removal of Snapshots – fix VM snapshot

Given the situation that the VM can be powered on without issues, new snapshots can be created but not deleted, something strange is going on with this virtual machine. Screening the vmware.log doesn´t help either and gives no information why the VM snapshot can´t be fixed. But bugs come typically with weird situations. Weird situations need to be treated with actions that doesn´t make too much sense.

In that case the solution is damn simple, migrate the virtual machine using either cold migration to another datastore or Storage vMotion. Hopefully it´s not your largest virtual machine and let´s keep the fingers crossed you have enough free space on another datastore to move all VMs data. Theoretically it might be enough just to move one of the vmdk files of the virtual machine, but we didn´t checked that so far.

After the successful datastore relocation the snapshots can be easily consilidated and the VM snapshot has just been fixed.

Conclusion

Definitely a VMware vSphere bug that can end up nasty when you don´t have any space left on a datastore to move the VM to get the file unlocked and fix a VM snapshot.

opvizor Snapwatcher - Say Goodbye to Broken Snapshots
opvizor provides a solution called Snapwatcher that can be downloaded on the opvizor website here at http://try.opvizor.com/snapwatcher/

opvizor owns ten different rules for detecting different VM snapshot-related errors and problems.

Sign Up for opvizor

CNIL
Metrics and Logs

(formerly, Opvizor Performance Analyzer)

VMware vSphere & Cloud
PERFORMANCE MONITORING, LOG ANALYSIS, LICENSE COMPLIANCE!

Monitor and Analyze Performance and Log files:
Performance monitoring for your systems and applications with log analysis (tamperproof using immudb) and license compliance (RedHat, Oracle, SAP and more) in one virtual appliance!

Subscribe to Our Newsletter

Get the latest product updates, company news, and special offers delivered right to your inbox.

Subscribe to our newsletter

Use Case - Tamper-resistant Clinical Trials

Goal:

Blockchain PoCs were unsuccessful due to complexity and lack of developers.

Still the goal of data immutability as well as client verification is a crucial. Furthermore, the system needs to be easy to use and operate (allowing backup, maintenance windows aso.).

Implementation:

immudb is running in different datacenters across the globe. All clinical trial information is stored in immudb either as transactions or the pdf documents as a whole.

Having that single source of truth with versioned, timestamped, and cryptographically verifiable records, enables a whole new way of transparency and trust.

Use Case - Finance

Goal:

Store the source data, the decision and the rule base for financial support from governments timestamped, verifiable.

A very important functionality is the ability to compare the historic decision (based on the past rulebase) with the rulebase at a different date. Fully cryptographic verifiable Time Travel queries are required to be able to achieve that comparison.

Implementation:

While the source data, rulebase and the documented decision are stored in verifiable Blobs in immudb, the transaction is stored using the relational layer of immudb.

That allows the use of immudb’s time travel capabilities to retrieve verified historic data and recalculate with the most recent rulebase.

Use Case - eCommerce and NFT marketplace

Goal:

No matter if it’s an eCommerce platform or NFT marketplace, the goals are similar:

  • High amount of transactions (potentially millions a second)
  • Ability to read and write multiple records within one transaction
  • prevent overwrite or updates on transactions
  • comply with regulations (PCI, GDPR, …)


Implementation:

immudb is typically scaled out using Hyperscaler (i. e. AWS, Google Cloud, Microsoft Azure) distributed across the Globe. Auditors are also distributed to track the verification proof over time. Additionally, the shop or marketplace applications store immudb cryptographic state information. That high level of integrity and tamper-evidence while maintaining a very high transaction speed is key for companies to chose immudb.

Use Case - IoT Sensor Data

Goal:

IoT sensor data received by devices collecting environment data needs to be stored locally in a cryptographically verifiable manner until the data is transferred to a central datacenter. The data integrity needs to be verifiable at any given point in time and while in transit.

Implementation:

immudb runs embedded on the IoT device itself and is consistently audited by external probes. The data transfer to audit is minimal and works even with minimum bandwidth and unreliable connections.

Whenever the IoT devices are connected to a high bandwidth, the data transfer happens to a data center (large immudb deployment) and the source and destination date integrity is fully verified.

Use Case - DevOps Evidence

Goal:

CI/CD and application build logs need to be stored auditable and tamper-evident.
A very high Performance is required as the system should not slow down any build process.
Scalability is key as billions of artifacts are expected within the next years.
Next to a possibility of integrity validation, data needs to be retrievable by pipeline job id or digital asset checksum.

Implementation:

As part of the CI/CD audit functionality, data is stored within immudb using the Key/Value functionality. Key is either the CI/CD job id (i. e. Jenkins or GitLab) or the checksum of the resulting build or container image.

White Paper — Registration

We will also send you the research paper
via email.

CodeNotary — Webinar

White Paper — Registration

Please let us know where we can send the whitepaper on CodeNotary Trusted Software Supply Chain. 

Become a partner

Start Your Trial

Please enter contact information to receive an email with the virtual appliance download instructions.

Start Free Trial

Please enter contact information to receive an email with the free trial details.