Symbolic links
Symbolic links (also called a symlink) are just entries in a filesystem directory that point towards another location. UNIX systems originally preferred to use what are called hard links, which link to the new location quite directly. The entry in the filesystem literally points to another spot on disk. To make this easier to manage, the normal approach now is to use soft symlinks, which are easily visible. The most common thing to relocate using a symlink in PostgreSQL is the WAL transaction log. You can do this after the database cluster is created (but with the server down!) like the following:
$ cd $PGDATA $ mv pg_xlog /disk $ ln -s /disk/pg_xlog pg_xlog $ ls -l pg_xlog lrwxrwxrwx 1 postgres postgres 11 2010-04-27 17:35 pg_xlog -> /disk/pg_xlog
Starting in PostgreSQL 8.3, it's possible to use the --xlogdir
parameter when running initdb
to create the cluster. This doesn't work any differently—it will just create the soft symlink for you. The...