Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I have tablespace A located in the directory /A1, and I would like to move it (everything) to directory /A2?

I use openSUSE + PostgreSQL 9.1, and if this simplifies anything -- I can stop it (entire server) without a problem. Please note I am asking about entire tablespace and the tablespace already contains data!

share|improve this question
up vote 3 down vote accepted

This excerpt from the docs should get you going:

The directory $PGDATA/pg_tblspc contains symbolic links that point to each of the non-built-in tablespaces defined in the cluster. Although not recommended, it is possible to adjust the tablespace layout by hand by redefining these links. Two warnings: do not do so while the server is running; and after you restart the server, update the pg_tablespace catalog with the new locations. (If you do not, pg_dump will continue to output the old tablespace locations.)

share|improve this answer
Thank you very much! It works, and it is fast. For the record pg_tablespace is a table in Postgresql catalog. – greenoldman Oct 13 '12 at 22:18
Seems PostgreSQL 9.2 removed the reference to a path in pg_tablespace. – julkiewicz Jan 10 '15 at 14:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.