Can I have multiple data directories?

Posted September 6, 2017 3k views
UbuntuPostgreSQLUbuntu 16.04

I have two databases on postgreSQL. I am running out of disk space and want to move one of my databases to a different directory. How can I do this?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


I believe that you can only have one data directory per PostgreSQL cluster. This answer here explains this quite well:

There can be only one data directory for each PostgreSQL cluster. A cluster is a postmaster listening on a port, managing several databases from a single data directory. You can have multiple clusters by starting multiple postmasters with pg_ctl or via a system service, each listening on a different port and using a different data dir.

If you have multiple clusters on a machine you have multiple data directories. It’s unusual to need to do this, but it is possible.