Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 808412E00AE for ; Wed, 28 May 2008 23:00:21 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 94717-02 for ; Wed, 28 May 2008 23:00:09 -0300 (ADT) X-Greylist: delayed 00:07:28.07046 by SQLgrey-1.7.6 Received: from server.firetrust.net (mailserver.firetrust.com [209.213.221.13]) by developer.postgresql.org (Postfix) with ESMTP id E4D2E2E0088 for ; Wed, 28 May 2008 23:00:11 -0300 (ADT) Received: from xpc (203-109-144-176.static.bliink.ihug.co.nz [203.109.144.176] (may be forged)) (authenticated bits=0) by server.firetrust.net (8.14.2/8.14.2) with ESMTP id m4T1qa4g025792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 29 May 2008 13:52:41 +1200 Date: Thu, 29 May 2008 13:52:35 +1200 From: Steve Holdoway To: pgsql-admin@postgresql.org Subject: Re: what happend to my database Message-Id: <20080529135235.d6fcad87.steve.holdoway@firetrust.com> In-Reply-To: <8078a1730805281837y1ed331bey4e7db16a63423cfa@mail.gmail.com> References: <8078a1730805281837y1ed331bey4e7db16a63423cfa@mail.gmail.com> Organization: Firetrust Ltd. X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-MailWasher-Server-Scanned: Checked by MailWasher server v2.3.1 (www.Firetrust.com) X-MailWasher-Server-Status: Clean X-Virus-Scanned: ClamAV 0.92.1/7281/Thu May 29 09:10:58 2008 on server.firetrust.net X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/234 X-Sequence-Number: 29318 On Wed, 28 May 2008 18:37:06 -0700 "Medi Montaseri" wrote: > Hi, > > I am faced with a database disapperance and seeking some explanations > outside of gremlins. > I had a database running at > > cat /etc/sysconfig/pgsl/postmaster > PGDATA=/qmsvol/pg_8.1.9/data > PGLOG=/var/log/pgsql/pgstartup.log > > Where /qmsvol is an iSCSI block device > A couple of days ago, my server was rebooted and by the time I got to it my > database was deleted, gone, zapped, not there any more. > > I looked at my pgstartup.log where I see the following.... > > postmaster cannot access the server configuration file > "/qmsvol/pg_8.1.9/postgresql.conf": Permission denied > over 17 times and then following by... > The database cluster will be initialized with locale en_US.UTF-8. > > I think the following happend... > Since my PGDATA was on an iSCSI device, by the time /etc/rc3.d/S64postgresql > was executed, the device below it was not available.....question...why the > error says "permission denied" vs "file not found". In the meantime, pg_ctl > kept trying and finally concluded that the data directory is blank, and > hence this must be a out-of-box case and he is good to initdb the PGDATA and > as it called initdb to do the job... the iSCSI volume below it came online > and by then the bomb had already been dropped. > > Now I need to find some facts to support this... When you mount a partition on linux, it does this by overlaying it's root directory with the existing one on the parent volume. Ownerships and permissions are also replaced. I expect that the /qmsvol directory will be owned by root, with fairly restrictive access rights. This will not be the case the root ( . ) directory on the external device, which will be postgres-friendly. > Where else can I look for forensics I don't think you need any more! To fix this, I'd do 2 things. First, start postgres much later in the boot sequence: cd /etc/rc3.d ; mv S64postgresql S99postgresql ( and the same in rc5.d if you're using a gui at all ). and do the converse to whichever script mounts your external devices. Also add in a test that the device is mounted in the start) block of /etc/init.d/postgresql... something simple like while [ ! -d /qmsvol/pg_8.1.9/data ] do sleep 5 done ( well, something that can't hang forever would be preferable! ). > > Thanks > Medi > hth, Steve -- Steve Holdoway