Skip to content

Support for read-only datadir mounts #658

@semohr

Description

@semohr

Heya, maybe an easy question to answer. Is it possible to mount a data directory in read-only mode?

We have an archive drive on our cluster that is read-only by default, and I want to access data from an old MariaDB database occasionally. The database is multiple terabytes in scale so I want to prevent copying if possible. I tried testing this with Docker Compose, but ran into multiple issues:

  1. Entrypoint chown : The official docker-entrypoint.sh tries to chown all files in the datadir, which fails on a read-only filesystem.
  2. Server startup writes : Even bypassing the entrypoint, MariaDB tries to create test files( *.lower-test) and will abort with (Errcode: 30 "Read-only file system")

Minimal Compose example:

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

I thought this might be a good place to ask the question, has anyone run into the same issue? Any suggestions for running MariaDB directly on a read-only datadir would be highly appreciated. I might be missing something crucial here.

[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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions