Skip to content

Notes on consistency

A forced backup while the application is in RUN mode can be inconsistent because the CODESYS runtime continues to access files in the controller file system while the backup is being created.

The system does not provide a mechanism to create an atomic snapshot of all files at a single point in time. Instead, files are read sequentially, and their states can change between the reading of individual files.

CODESYS generally recommends putting the application into the STOP state before performing a backup.

Possible inconsistencies

Depending on your specific use case, determine whether the inconsistencies described here are acceptable for your intended purpose.

Scope Risk
Retain/persistent data Saved values may reflect a different point in time than the saved application code. During a restore, variable values may no longer match the current state of the program.
Boot application If an online change is performed during the backup, the .app file may be saved in a transitional state.
External files Project-dependent files may change during the read operation if the application is actively accessing them.

Decision: Backup in STOP or RUN?

Whether a backup must be performed in STOP mode or can be created in RUN mode depends on the specific application.

A backup in the RUN state may be sufficient if:

  • the goal is purely to version the application code (e.g., to track program changes),
  • no retain or persistent data is required for a complete restore,
  • no online changes are performed during the backup window,
  • potentially inconsistent backup is preferable to having no backup at all (e.g., in systems that cannot be shut down as scheduled).

A backup in the STOP mode is recommended if:

  • a complete and consistent restore of the application, including all retained/persistent data, must be guaranteed (e.g., for disaster recovery),
  • the application performs safety-critical functions where inconsistent data could lead to malfunctions,
  • the backup serves as a reference for validation or qualification (e.g., in regulated environments),
  • multiple applications are running on the controller, and their states must be consistent with one another.