Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37526

Support for running MariaDB with a read-only data directory

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11, 11.8.3, 12.0.2
    • 10.11, 11.4, 11.8
    • Server
    • None
    • MariaDB latest (Docker image, August 2025)
      Host: Linux x86_64 / redhat

    Description

      Description
      I would like to run MariaDB against a read-only data directory for archival purposes. The use case is accessing an old database (multiple TBs) on an archive drive that is mounted read-only by default. Copying this data is impractical, but occasional queries are still needed.

      Currently this is not possible, because MariaDB expects to create/write certain files inside the datadir during startup.

      Example failure:

      [ERROR] mariadbd: Can't create/write to file './ddl_recovery.log' (Errcode: 30 "Read-only file system")
      [ERROR] DDL_LOG: Failed to create ddl log file: ./ddl_recovery.log
      [ERROR] Aborting
      

      Feature Request
      Add configuration options to relocate or disable files that must otherwise be created in the datadir (e.g. `ddl_recovery.log`, `*.lower-test`, etc.). This would allow MariaDB to start successfully with a read-only datadir, provided all logging and temporary files are redirected elsewhere.

      Minimal Repro (Docker Compose)

      services:
        mariadb:
          image: mariadb:latest
          container_name: old_mariadb
          volumes:
            - ./data:/mnt/data:ro   # read-only dataset
          ports:
            - "3306:3306"
          entrypoint: ["mariadbd"]   # bypass entrypoint to skip chown
          command: >
            --datadir=/mnt/data
            --basedir=/usr
            --read-only=ON
            --skip-log-bin
            --tmpdir=/var/tmp
      

      Why this matters
      Enabling MariaDB to run on a read-only datadir would support:

      • Querying archive databases without risk of modification.
      • Running MariaDB directly on cold-storage volumes.
      • Safer "forensic" or "historic" analysis use cases.

      Even with `--read-only=ON` and external `tmpdir/log` paths, the server still expects to write into the datadir, which prevents this use case today.

      see also github

      If this is already possible and I have missed something, help getting around this issues would be highly appreciated!

      Attachments

        Activity

          People

            Unassigned Unassigned
            semohr Serious Marger
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.