Re: Documentation for initdb option --waldir - Mailing list pgsql-docs

From Laurenz Albe
Subject Re: Documentation for initdb option --waldir
Date
Msg-id 990b0bfa9ad2e68c517c3d5a29c48d37758877a1.camel@cybertec.at
Whole thread Raw
In response to Re: Documentation for initdb option --waldir  (Robert Treat <rob@xzilla.net>)
Responses Re: Documentation for initdb option --waldir
List pgsql-docs
On Sat, 2025-03-29 at 10:26 -0400, Robert Treat wrote:
> "Best practice is to create a directory within the mount-point
> directory that is owned by the PostgreSQL user, and then create the
> data directory within that. This avoids permissions problems,..."
>
> Which I do remember having tried to do it directly and the OS
> complaining that my mount point wasn't owned by root and/or Postgres
> complaining that the xlog dir wasn't owned by Postgres, so I think
> this advice probably still holds.

The root directory of a file system, which will be mounted at the
mount point, should be owned by root.

As far as I know, the reason is that it contains a "lost+found"
directory, which is used by file system checks to put orphaned
files.  If a non-root user owned the mount point, the user could
remove that directory, which would be a bad idea.

On the other hand, PostgreSQL will protest if the directory isn't
empty...

Yours,
Laurenz Albe



pgsql-docs by date:

Previous
From: "Gurjeet Singh"
Date:
Subject: Re: Documentation for initdb option --waldir
Next
From: "Gurjeet Singh"
Date:
Subject: Re: Documentation for initdb option --waldir