When installing PostgreSQL on debian the install process asks you what directory you want to contain your actual table data – which is nice when you want to use a dedicated partition instead of the default /var/lib/postgresql/data. However, in Ubuntu (Dapper Drake and Breezy Badger) the install process doesn’t give you the option of changing the default directory. Here are some quick notes on how to change the data directory to an existing non-default data dir (specifically for postgresql 7.4):
- remove the
/etc/postgresql/7.4/main/pgdatasymlink - create a new
pgdatasymlink that points to your desired data directory. - Make sure the
pg_hba.conf,pg_ident.conf,postgresql.confandroot.crtsymlinks in the data dir point back to the originals in/etc/postgresql/7.4/main
Restart postgres and you should now be running from you desired, non-default data directory.
tags: postgresql,postgres,ubuntu
