Re: Documentation for initdb option --waldir

From: Robert Treat <rob(at)xzilla(dot)net>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Euler Taveira <euler(at)eulerto(dot)com>, Theodor Herlo <t(dot)herlo(at)proventa(dot)de>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Documentation for initdb option --waldir
Date: 2025-03-29 14:26:49
Message-ID: CAJSLCQ3J31T0VrKZ+Ad1qBvECmEFByfY5JrJ6z2bX=8OnN+GZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, Mar 27, 2025 at 5:57 PM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Thu, Mar 27, 2025 at 2:28 PM Robert Treat <rob(at)xzilla(dot)net> wrote:
>> On Thu, Mar 27, 2025 at 12:06 PM David G. Johnston
>> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>> > I expanded upon the material regarding using different file systems and disks.
>> >
>> > I would like to add a similar "why" to the mount point recommendation but don't know what that would be. Suggestions welcomed.
>> >
>>
>> I'm not sure I follow what you are asking for... but a non-performance
>> reason to use a seperate mount point for pg_wal, even if the
>> underlying storage is the same, would be for something like using
>> filesystem snapshots to grab contents of the data directory without
>> grabbing wal (which can be handled separately).
>>
>
> If I mount the filesystem on disk2 to: /mnt/disk2
> Why do I need to create "/mnt/disk2/wal_files/" and point there instead of: "/mnt/disk2/"?
>

My immediate response to this was "because Postgres won't let you"
which seemed unhelpful, and that I couldn't remember why was pretty
unsatisfying, so I dug around in the source which was unhelpful but
eventually came across this from
https://www.postgresql.org/docs/devel/creating-cluster.html#CREATING-CLUSTER-MOUNT-POINTS

"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.

Robert Treat
https://xzilla.net

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2025-03-29 14:48:36 Re: Creating first database
Previous Message Tom Lane 2025-03-29 13:56:10 Re: Creating first database