Depending on your environment, you might want to select a location other than the default for data files. For example, you might want to store data files on a volume with plenty of space for housekeeping operations.

In this procedure, you replace PathToPreferredDisk with the path to a disk location that has the optimal space and throughput.

1

Run /usr/pgsql-9.1/bin/pg_ctl -D /var/lib/pgsql/9.1/data -l ~/logs/logfile stop -m fast to stop PostgreSQL.

2

Run Export $PGDATA PathToPreferredDisk/data to set the $PGDATA environment variable to point to the required location.

3

Run mkdir -p PathToPreferredDisk to create a directory on the required volume.

4

Run mv /var/lib/psql/9.1/data PathToPreferredDisk to move the data files to the new location.

5

Run /usr/pgsql-9.1/bin/pg_ctl -D $PGDATA -l $PGDATA/pg_log/logfile start to restart PostgreSQL.

Define the PostgreSQL environment variables. See Define PostgreSQL Environment Variables