Skip to content

PostgreSQL initialization fails with ext4 volume #352

@alexnazarv

Description

@alexnazarv

During deployment in the cluster, PostgreSQL initialization fails with the following error:

│ initdb: error: directory "/var/lib/postgresql/data" exists but is not empty                                                                                │
│ initdb: detail: It contains a lost+found directory, perhaps due to it being a mount point.                                                                 │
│ initdb: hint: Using a mount point directly as the data directory is not recommended.                                                                       │
│ Create a subdirectory under the mount point.

This happens because the /var/lib/postgresql/data directory is a mount point on ext4 volumes and contains the system-generated lost+found folder, which prevents initdb from running properly.

Suggestion:

Add PGDATA environment variable to explicitly point PostgreSQL to use /var/lib/postgresql/data/pgdata subdirectory as the data directory.

Metadata

Metadata

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