Symbolic links

Symbolic links (also called symlinks) 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 directly. The entry in the filesystem literally points to another spot on the 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_wal /disk
$ ln -s /disk/pg_wal pg_wal
$ ls -l pg_wal
lrwxrwxrwx 1 postgrespostgres 11 2010-04-27 17:35 pg_wal ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.