It's pretty easy to move a Postgres data directory in openSUSE. These instructions assume you installed Postgres using Yast or Zypper, but some stuff would apply to other package managers or a manual install.
Note: You need to be su.
0) Stop postgres, if it's running:
-/etc/init.d/postgresql stop
1) Find the existing data directory. For me, it was under /var/lib/pgsql/data. If, for whatever reason, you don't find anything there, try this: find / -name pgsql | grep data
2) Copy the contents of that data directory into its new home. For example, let's say I have created a new data partition, which I've mounted as /postgdata.
-cp -R /var/lib/pgsql/data/* /postgdata
3) Change ownership and permissions of that directory:
-chown -R postgres /postgdata
-chgrp -R postgres /postgdata
-chmod -R 700 /postgdata
3) Open the postgres init file. This is generally under /etc/init.d/postgresql.
-vim /etc/init.d/postgresql
4) Look for a line beginning with "eval DATADIR=${POSTG..." and comment it out by prefixing it with a #. Just below that, add a new line reading:
-eval DATADIR=/postgdata
5) Save and start postgres.
A librarian's take on tech and gadget news
Tuesday, June 23, 2009
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment