Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 37DBC632E72 for ; Sat, 27 Feb 2010 03:41:20 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 07271-04 for ; Sat, 27 Feb 2010 07:41:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f187.google.com (mail-iw0-f187.google.com [209.85.223.187]) by mail.postgresql.org (Postfix) with ESMTP id A2EFE632E10 for ; Sat, 27 Feb 2010 03:41:09 -0400 (AST) Received: by iwn17 with SMTP id 17so858987iwn.19 for ; Fri, 26 Feb 2010 23:41:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Eyy0gkuSMAx2XOTiVOy5mQHFTHRkZWRfgTnr78SGw/g=; b=lJWwQZ3vsgW5DbjhB9RtIVpsaUkL43O0xVoZ5BapcK2hwA9FPTFfBg5zo1AL/0vEH7 hzfV4frBFupyYGEiFPlxkYmUUP8r/xwbDirY3ni+8xI8h9Bqylu2sbJiADQfUl8Xz5SD 5cT7LoRpP9FIlORxOn8R8SdQpxXoErHxwzE6Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Sm9m+hlu1VGHHyC1J/e4KckgmYDBMhtqgYKiDZllEJkCYvucqWGkVpQaMMhLYSM5tk BYT/s8ut+Lxbd01zQrK7CiYiu/H5u/mdhg+24z/N1+YQ6LgihYnnKMuDPMYgXIuiaNsw LxGwxAxnHOIGDTRA1O091z34mLOn8TYc1wrQQ= MIME-Version: 1.0 Received: by 10.231.174.140 with SMTP id t12mr189940ibz.89.1267256468518; Fri, 26 Feb 2010 23:41:08 -0800 (PST) In-Reply-To: <9762.1267234886@sss.pgh.pa.us> References: <9762.1267234886@sss.pgh.pa.us> Date: Sat, 27 Feb 2010 01:41:08 -0600 Message-ID: Subject: Re: db recovery after hd crash (could not open relation 1663/16385/16400: No such file or directory) From: Roland Wells To: Tom Lane Cc: pgsql-admin@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/195 X-Sequence-Number: 33798 On Fri, Feb 26, 2010 at 7:41 PM, Tom Lane wrote: > Roland Wells writes: >> On new hardware, installed pg8.1 and restored data directory and >> attempted to start pg. After fixing some config differences, it >> complained of a missing pg_clog/xxx file. After searching the archives >> for hints, added a file of zero's and pg starts successfully. The db >> in question exists with what appears to be intact structure. When >> attempting to dump the db ran into the error: "could not open relation >> 1663/16385/16400: No such file or directory" and run into similar >> errors (with different relation numbers) trying to select * from >> certain tables. > >> I'm stuck here. Assuming the damage to filesystem, what is the best a >> way forward? Does the relation error indicate damage to the data? or >> to an index??? Is there a process I can do to try and salvage partial >> data? > > You can look for the third number in pg_class.relfilenode to see exactly > which table or index it's complaining about. =A0If it's happening in > pg_dump then it's probably a table not an index, unfortunately. > Not sure there's much you can do except go back to your last backup > --- PG can't do anything to recover data that the filesystem has lost > track of, which is what this is sounding like. > > But having said that, did you try fsck'ing the DD image to see if fsck > could recover any files? > Thanks for the replies: A look at pg_class.relfilenode seems to confirm that tables are missing (7 out of 52 tables in the db are missing). I did do an fsck on the restored disk image and there is quite a few files in the lost+found. I am still wading through them at the moment, but not hopeful of recovery this way as many I've looked at so far appear to only be partial files. Additionally, several of the tables in the db show far less rows than should exist, so there may be damage to those files as well... Probably will head to the backup. Thanks again. Roland