From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jonathan Vanasco <postgres(at)2xlp(dot)com> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Are there any downsides to using postgres' data directory on a dedicated drive/partition / filesystem? |
Date: | 2014-11-13 21:44:23 |
Message-ID: | 20238.1415915063@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Jonathan Vanasco <postgres(at)2xlp(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Guyren Howe | 2014-11-13 21:46:17 | hstore, but with fast range comparisons? |
Previous Message | John R Pierce | 2014-11-13 21:17:15 | Re: Re: Are there any downsides to using postgres' data directory on a dedicated drive/partition / filesystem? |