Thread: /Var Partition Full - How can a change PGDATA?

/Var Partition Full - How can a change PGDATA?

From
Professor Flávio Brito
Date:
Hi

I´m in a big trouble. I need a help!!

My /var server partition  is full. I copied data dir to another partition. I changed owners of dirs and files (postgres.postgres) . I changed /etc/init.d/postgresql PGDATA to a new value, but when I try to load postgresql,this message appears

---pgstartup.log
runuser: warning: cannot change directory to /var/lib/pgsql: No such file or directory
runuser: warning: cannot change directory to /var/lib/pgsql: No such file or directory
----

I have a PostgreSQl 8.2.6 on a RHE4 Server
All my systems are stopped. Please a need some help.
There is no enough free space at /var . I cleaned all log files, but without success 

Thanks

Flávio Brito

PS: Excuse my english
----------------------------------------------
Some commands

# /etc/init.d/postgresql stop
# cd /var/lib/pgsql/
# cp -pr data/ /sistema/
#chown -R postgres.postgres postgresql/

#vi /etc/init.d/postgresql
---------------------------------------------------------------
PGENGINE=/usr/bin
PGPORT=5432
#PGDATA=/var/lib/pgsql/data Mudanca diretorio - particao /var cheia em 07/10/2009
PGDATA=/sistema/postgresql/data
if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base/template1" ]
then
        echo "Using old-style directory structure"
else
        #GDATA=/var/lib/pgsql/data
        PGDATA=/sistema/postgresql/data
fi
#PGLOG=/var/lib/pgsql/pgstartup.log
PGLOG=/sistema/postgresql/pgstartup.log

# Override defaults from /etc/sysconfig/pgsql if file is present
[ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}

export PGDATA
export PGPORT


Re: /Var Partition Full - How can a change PGDATA?

From
Michael Wood
Date:
Hi

2009/10/7 Professor Flávio Brito <prof.flaviobrito@gmail.com>:
> Hi
>
> I´m in a big trouble. I need a help!!

See below for the "proper" answer, but if you need this working in a
hurry, you could try using a symlink instead:

ln -s /sistema/postgresql /var/lib/pgsql
(or something like that.)

> My /var server partition  is full. I copied data dir to another partition. I
> changed owners of dirs and files (postgres.postgres) . I changed
> /etc/init.d/postgresql PGDATA to a new value, but when I try to load
> postgresql,this message appears
>
> ---pgstartup.log
> runuser: warning: cannot change directory to /var/lib/pgsql: No such file or
> directory
> runuser: warning: cannot change directory to /var/lib/pgsql: No such file or
> directory
[...]

In your commands below you do not remove /var/lib/pgsql.  You only
mention /var/lib/pgsql/data, so why is /var/lib/pgsql not there?  Did
you also move it to /sistema/...?

> Some commands
>
> # /etc/init.d/postgresql stop
> # cd /var/lib/pgsql/
> # cp -pr data/ /sistema/

This would put a copy of data into /systema/data.  Not
/sistema/postgresql/data like in the /etc/init.d/postgresql script.
So I think maybe you have not told us all the commands that you ran.

> #chown -R postgres.postgres postgresql/
>
> #vi /etc/init.d/postgresql
> ---------------------------------------------------------------
> PGENGINE=/usr/bin
> PGPORT=5432
> #PGDATA=/var/lib/pgsql/data Mudanca diretorio - particao /var cheia em
> 07/10/2009
> PGDATA=/sistema/postgresql/data
> if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base/template1" ]
> then
>         echo "Using old-style directory structure"
> else
>         #GDATA=/var/lib/pgsql/data
>         PGDATA=/sistema/postgresql/data
> fi
> #PGLOG=/var/lib/pgsql/pgstartup.log
> PGLOG=/sistema/postgresql/pgstartup.log
>
> # Override defaults from /etc/sysconfig/pgsql if file is present
> [ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}
>
> export PGDATA
> export PGPORT

What is in /etc/sysconfig/pgsql/*?  Maybe PGDATA is being redefined there?

--
Michael Wood <esiotrot@gmail.com>

Re: /Var Partition Full - How can a change PGDATA?

From
Professor Flávio Brito
Date:
Hi Michael and List

I did  ln -sf /sistema/postgresql /var/lib/pgsql ; chown -h postgres.postgres pgsql

as you told me, but without success.

In my command list I copied to a right place (my command list omitted it ) at the second try

#cd /var/lib/pgsql
#cp -pr data /sistema/postgresql

--------------------------------------------------------
New PGDATA
/sistema/postgresql/data

Old PGDATA
/var/lib/pgsql (renamed to /var/lib/pgsql_old
-----------------------------------------------------------------------------------------
I created postgresql at  /etc/sysconfig/pgsql/
PGDATA=/sistema/postgresql/data
PGPORT=3456
-----------------------------------------------------------------------------------------



2009/10/7 Michael Wood <esiotrot@gmail.com>
Hi

2009/10/7 Professor Flávio Brito <prof.flaviobrito@gmail.com>:
> Hi
>
> I´m in a big trouble. I need a help!!

See below for the "proper" answer, but if you need this working in a
hurry, you could try using a symlink instead:

ln -s /sistema/postgresql /var/lib/pgsql
(or something like that.)

> My /var server partition  is full. I copied data dir to another partition. I
> changed owners of dirs and files (postgres.postgres) . I changed
> /etc/init.d/postgresql PGDATA to a new value, but when I try to load
> postgresql,this message appears
>
> ---pgstartup.log
> runuser: warning: cannot change directory to /var/lib/pgsql: No such file or
> directory
> runuser: warning: cannot change directory to /var/lib/pgsql: No such file or
> directory
[...]

In your commands below you do not remove /var/lib/pgsql.  You only
mention /var/lib/pgsql/data, so why is /var/lib/pgsql not there?  Did
you also move it to /sistema/...?

> Some commands
>
> # /etc/init.d/postgresql stop
> # cd /var/lib/pgsql/
> # cp -pr data/ /sistema/

This would put a copy of data into /systema/data.  Not
/sistema/postgresql/data like in the /etc/init.d/postgresql script.
So I think maybe you have not told us all the commands that you ran.

> #chown -R postgres.postgres postgresql/
>
> #vi /etc/init.d/postgresql
> ---------------------------------------------------------------
> PGENGINE=/usr/bin
> PGPORT=5432
> #PGDATA=/var/lib/pgsql/data Mudanca diretorio - particao /var cheia em
> 07/10/2009
> PGDATA=/sistema/postgresql/data
> if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base/template1" ]
> then
>         echo "Using old-style directory structure"
> else
>         #GDATA=/var/lib/pgsql/data
>         PGDATA=/sistema/postgresql/data
> fi
> #PGLOG=/var/lib/pgsql/pgstartup.log
> PGLOG=/sistema/postgresql/pgstartup.log
>
> # Override defaults from /etc/sysconfig/pgsql if file is present
> [ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}
>
> export PGDATA
> export PGPORT

What is in /etc/sysconfig/pgsql/*?  Maybe PGDATA is being redefined there?

--
Michael Wood <esiotrot@gmail.com>

Re: /Var Partition Full - How can a change PGDATA?

From
Michael Wood
Date:
Hi

2009/10/7 Professor Flávio Brito <prof.flaviobrito@gmail.com>:
> Hi Michael and List
>
> I did  ln -sf /sistema/postgresql /var/lib/pgsql ; chown -h
> postgres.postgres pgsql
>
> as you told me, but without success.

Did you get the same error message or a different one?

> In my command list I copied to a right place (my command list omitted it )
> at the second try
>
> #cd /var/lib/pgsql
> #cp -pr data /sistema/postgresql
>
> --------------------------------------------------------
> New PGDATA
> /sistema/postgresql/data
>
> Old PGDATA
> /var/lib/pgsql (renamed to /var/lib/pgsql_old
> -----------------------------------------------------------------------------------------
> I created postgresql at  /etc/sysconfig/pgsql/

So it wasn't there previously?

> PGDATA=/sistema/postgresql/data
> PGPORT=3456
> -----------------------------------------------------------------------------------------

You could try running /etc/init.d/postgresql as follows to see more
details about what it is doing:

sh -x /etc/init.d/postgresql

Maybe it will help to understand what is going wrong.

--
Michael Wood <esiotrot@gmail.com>

Re: /Var Partition Full - How can a change PGDATA?

From
Luiz Eduardo Cantanhede Neri
Date:
Hi Flávio,

Try to check your bash.rc, pg data my be setting there. If it dont try to export the new value of pg data from there. When the system reboot try to echo $PGDATA and check if it has the correct value.


[]'s
Luiz Eduardo Neri

2009/10/9 Michael Wood <esiotrot@gmail.com>
Hi

2009/10/7 Professor Flávio Brito <prof.flaviobrito@gmail.com>:
> Hi Michael and List
>
> I did  ln -sf /sistema/postgresql /var/lib/pgsql ; chown -h
> postgres.postgres pgsql
>
> as you told me, but without success.

Did you get the same error message or a different one?

> In my command list I copied to a right place (my command list omitted it )
> at the second try
>
> #cd /var/lib/pgsql
> #cp -pr data /sistema/postgresql
>
> --------------------------------------------------------
> New PGDATA
> /sistema/postgresql/data
>
> Old PGDATA
> /var/lib/pgsql (renamed to /var/lib/pgsql_old
> -----------------------------------------------------------------------------------------
> I created postgresql at  /etc/sysconfig/pgsql/

So it wasn't there previously?

> PGDATA=/sistema/postgresql/data
> PGPORT=3456
> -----------------------------------------------------------------------------------------

You could try running /etc/init.d/postgresql as follows to see more
details about what it is doing:

sh -x /etc/init.d/postgresql

Maybe it will help to understand what is going wrong.

--
Michael Wood <esiotrot@gmail.com>

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice