I have created all tablespaces (only tables created in these tablespaces) in mounted partition, But db is available in pg_default tablespace (root partition where postgresql installed).
I am facing problem with memory since my root partition having only 10 GB. I have verified the data folder (/opt/postgresql/9.1/data/), and noticed few things.
- /opt/postgresql/9.1/data/base directory having more data
- pg_largeobject table is having more data
So, I planned to do following activity,
- Take the full backup of existing database(s) – custom format (*.sql)
- Uninstall the postgresql from the root directory, using uninstall.sh (which is available the postgresql path)
- Install the new postgresql in mounted path (/newly/mounted/remote/path/postgresql/)
If I do above steps, will postgresql service start and work without any issue?
(if no issue, I will restore the database backup)
Any suggestion?
(using postgresql-9.1)
Best Answer
Yes, you can move your base directory to any location you wish where the postgres service has write access and enough storage available. There are a few things to note
Tablespaces are directories that are pointed to by symbolic links in $PGDATA so you can keep them if you like. They will be resolved.