Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 2 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
add comment

Your Answer

 
discard

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.