Re: Are there any downsides to using postgres' data directory on a dedicated drive/partition / filesystem? - Mailing list pgsql-general

From Tom Lane
Subject Re: Are there any downsides to using postgres' data directory on a dedicated drive/partition / filesystem?
Date
Msg-id 20238.1415915063@sss.pgh.pa.us
Whole thread Raw
In response to Are there any downsides to using postgres' data directory on a dedicated drive/partition / filesystem?  (Jonathan Vanasco <postgres@2xlp.com>)
Responses Re: Are there any downsides to using postgres' data directory on a dedicated drive/partition / filesystem?  (Jonathan Vanasco <postgres@2xlp.com>)
List pgsql-general
Jonathan Vanasco <postgres@2xlp.com> writes:
> I'm running postgres on a virtual server
> I was wondering if there were any known issues with moving the data directory to another mounted partition /
filesystem.  

You can put the database directory anywhere you want.

Obviously, it has to be trustworthy storage, and in that respect I'd
caution against soft-mounted storage.  There's a disaster story in the
PG list archives somewhere (quite some time back, maybe 10 years ago)
about somebody who had their database on NFS storage.  One day the
NFS server was a bit slow to mount after a reboot and didn't come up
until after the postgres server start script had launched.  This was
one of those "helpful" vendor-supplied start scripts that would
automatically run initdb if the data directory wasn't there.  So it
started up, looked at $PGDATA and didn't find anything, and launched
initdb.  initdb faithfully checked that $PGDATA was empty (still true)
and set about creating files.  Right after that, the NFS server finally
comes online ... and now initdb is scribbling over the system catalogs
of the live database.  Needless to say, that did not end well.

Disconnecting storage from under an already-running postmaster will
possibly spoil your day too, although it should be reasonably survivable
as long as it wasn't the WAL logs you dismounted.

So, while you can do what you like, it behooves you to think about
possible failure modes anytime you choose to put the database directory
(or a tablespace directory) on any dismountable storage.

            regards, tom lane


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Re: Are there any downsides to using postgres' data directory on a dedicated drive/partition / filesystem?
Next
From: Guyren Howe
Date:
Subject: hstore, but with fast range comparisons?