Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gz1Lm-0007cH-Ve for pgsql-general@arkaria.postgresql.org; Wed, 27 Feb 2019 15:42:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gz1Ll-0002X5-5i for pgsql-general@arkaria.postgresql.org; Wed, 27 Feb 2019 15:42:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gz1Lk-0002Uo-ON for pgsql-general@lists.postgresql.org; Wed, 27 Feb 2019 15:42:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gz1La-0006d0-Bx for pgsql-general@postgresql.org; Wed, 27 Feb 2019 15:42:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x1RFgCQO014945; Wed, 27 Feb 2019 10:42:12 -0500 From: Tom Lane To: Luca Ferrari cc: Julien Rouhaud , pgsql-general Subject: Re: why not using a mountpoint as PGDATA? In-reply-to: References: Comments: In-reply-to Luca Ferrari message dated "Wed, 27 Feb 2019 12:52:06 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14943.1551282132.1@sss.pgh.pa.us> Date: Wed, 27 Feb 2019 10:42:12 -0500 Message-ID: <14944.1551282132@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Luca Ferrari writes: > On Wed, Feb 27, 2019 at 12:33 PM Julien Rouhaud wrote: >> You can see most obvious reasons at >> https://bugzilla.redhat.com/show_bug.cgi?id=1247477 > Thanks, I didn't see the lost+found problem because I'm on UFS (I'm > wondering if this applies also to ZFS datasetes with mount point). > Same story for the accidentally umount, since FreeBSD seems enough > friendly to avoid umount while the database is running, but it could > definetely happen with some brute force or on another operating > system. The case that I can recall most clearly was actually in the other direction: during system bootup, some NFS volume that was being abused this way (mount point == data dir) was slow to mount. Compounding the problem, postgres was being started through some init script that would helpfully run initdb if it saw the specified data directory was empty. So, rather than failing like a properly paranoid DBA would wish, it ran initdb and then started the postmaster. A bit later, the NFS volume came online, replacing the mount-point directory, and now the postmaster had a devil's brew of open files on the local volume containing the mount point and open files on the NFS volume. It didn't take long for that to translate into hopeless catalog corruption. I don't think they ever got their data back. The true value of data-dir-at-least-one-level-down is so that it will fail to be there at all if the file system isn't mounted. You need that, and you do *not* want automated attempts to "repair" that. regards, tom lane