Skip to content

Conversation

@alexnazarv
Copy link

@alexnazarv alexnazarv commented Jul 18, 2025

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.

What was changed:

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

This change fixes the deployment issue by ensuring that the data directory is a dedicated subdirectory rather than the root of the mount point.

@alexnazarv
Copy link
Author

Related to #352

@Marginy605 Marginy605 requested review from flukolo4ek and removed request for imsitnikov August 6, 2025 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant