MongoDB is not starting after VM Snapshot revert


About this task

With MongoDB version 7.0 and later, the database might not start immediately following a virtual machine (VM) restart or a VM snapshot revert.
This issue is often due to an unclean shutdown detection, which triggers a data recovery process.

Applies to

BVQ Version: 2024.Hx


Procedure

When a VM snapshot is reverted or the VM is restarted, MongoDB might not start as expected. This behavior is typically accompanied by the following log messages:

C:\ProgramData\SVA\BVQ\bvq-mongodb\logs
Detected unclean shutdown - Lock file is not empty
Recovering data from the last clean checkpoint.


During this recovery process, no new log entries will be written, making it seem as though MongoDB is not active. However, the database is performing necessary recovery operations.

Procedure

  1. Detection of Unclean Shutdown:

    • Upon restarting, MongoDB detects an unclean shutdown, indicated by the presence of a non-empty lock file.
    • This triggers the database to enter a recovery mode to ensure data integrity.

  2. Recovery Process:

    • MongoDB attempts to recover data from the last known clean checkpoint.
    • During this time, the database performs various integrity checks and restoration tasks.
    • It is common for the logs to remain static during this period, giving the appearance that MongoDB is not running.

Expected Recovery Time

  • For large databases, the recovery process can take a significant amount of time. Based on observed cases, recovery times can be around 45 minutes or more.