Thread: Moving pg_xlog to another drive

Moving pg_xlog to another drive

From
Ben
Date:
I'm trying to move my WAL to another drive, but am having difficulties
with this seemingly simple process. Every time I start up with pg_xlog
symlinked to my other drive, I get this:

FATAL:  could not open file "pg_xlog/00000001.history": Permission denied

If I move pg_xlog back into its normal place then things work fine. The
postgres user can certainly create files when using the symlink, so I
really don't think it's a permission issue... but I'm at a loss as to what
else it might be.

This is on CentOS 5 with the latest RPMs. SELinux is not enforcing (nor
logging any events when I do this stuff).

Re: Moving pg_xlog to another drive

From
"Joshua D. Drake"
Date:
Ben wrote:
> I'm trying to move my WAL to another drive, but am having difficulties
> with this seemingly simple process. Every time I start up with pg_xlog
> symlinked to my other drive, I get this:
>
> FATAL:  could not open file "pg_xlog/00000001.history": Permission denied
>
> If I move pg_xlog back into its normal place then things work fine. The
> postgres user can certainly create files when using the symlink, so I
> really don't think it's a permission issue... but I'm at a loss as to
> what else it might be.

Is the parent directory of the place you are moving pg_xlog to a place
that the postgres user can enter?

>
> This is on CentOS 5 with the latest RPMs. SELinux is not enforcing (nor
> logging any events when I do this stuff).
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faq
>


--

       === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
              http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/


Re: Moving pg_xlog to another drive

From
Alvaro Herrera
Date:
Ben wrote:
> I'm trying to move my WAL to another drive, but am having difficulties
> with this seemingly simple process. Every time I start up with pg_xlog
> symlinked to my other drive, I get this:
>
> FATAL:  could not open file "pg_xlog/00000001.history": Permission denied
>
> If I move pg_xlog back into its normal place then things work fine. The
> postgres user can certainly create files when using the symlink, so I
> really don't think it's a permission issue... but I'm at a loss as to what
> else it might be.

Maybe the postgres user does not have all permissions in dirs leading to
the new directory?  You must give it at least "x" permissions on all
levels up to the parent.

--
Alvaro Herrera                         http://www.flickr.com/photos/alvherre/
Criptografía: Poderosa técnica algorítmica de codificación que es
empleada en la creación de manuales de computadores.

Re: Moving pg_xlog to another drive

From
Ben
Date:
On Mon, 4 Jun 2007, Joshua D. Drake wrote:

> Ben wrote:
>> I'm trying to move my WAL to another drive, but am having difficulties with
>> this seemingly simple process. Every time I start up with pg_xlog symlinked
>> to my other drive, I get this:
>>
>> FATAL:  could not open file "pg_xlog/00000001.history": Permission denied
>>
>> If I move pg_xlog back into its normal place then things work fine. The
>> postgres user can certainly create files when using the symlink, so I
>> really don't think it's a permission issue... but I'm at a loss as to what
>> else it might be.
>
> Is the parent directory of the place you are moving pg_xlog to a place that
> the postgres user can enter?

Sorry, yes, I neglected to mention that the postgres user can enter every
directory along the path to the new pg_xlog directory. In addition,
pg_xlog remains owned by postgres.postgres, as does its parent directory,
and the new pg_xlog directory has permissions of 0700.

So I really can't see why it would be a permission issue.

Re: Moving pg_xlog to another drive

From
Steve Atkins
Date:
On Jun 4, 2007, at 11:15 AM, Ben wrote:

> On Mon, 4 Jun 2007, Joshua D. Drake wrote:
>
>> Ben wrote:
>>> I'm trying to move my WAL to another drive, but am having
>>> difficulties with this seemingly simple process. Every time I
>>> start up with pg_xlog symlinked to my other drive, I get this:
>>> FATAL:  could not open file "pg_xlog/00000001.history":
>>> Permission denied
>>> If I move pg_xlog back into its normal place then things work
>>> fine. The postgres user can certainly create files when using the
>>> symlink, so I really don't think it's a permission issue... but
>>> I'm at a loss as to what else it might be.
>>
>> Is the parent directory of the place you are moving pg_xlog to a
>> place that the postgres user can enter?
>
> Sorry, yes, I neglected to mention that the postgres user can enter
> every directory along the path to the new pg_xlog directory. In
> addition, pg_xlog remains owned by postgres.postgres, as does its
> parent directory, and the new pg_xlog directory has permissions of
> 0700.
>
> So I really can't see why it would be a permission issue.

Are you running SELinux? It's main goal in life is to break disk
access by denying permission to files anywhere other than where it
thinks an application should be allowed to access.

Cheers,
   Steve


Re: Moving pg_xlog to another drive

From
Ben
Date:
On Mon, 4 Jun 2007, Steve Atkins wrote:

> Are you running SELinux? It's main goal in life is to break disk access by
> denying permission to files anywhere other than where it thinks an
> application should be allowed to access.

Bleh. I am, but I *thought* it was not enforcing. Seems I was wrong.
Thanks for pointing out the one area I hadn't double-checked. :)