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.


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


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


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


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


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