Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7h5U-0007Rh-Nn for pgsql-general@arkaria.postgresql.org; Sun, 15 Apr 2018 12:48:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f7h5R-0001nJ-SG for pgsql-general@arkaria.postgresql.org; Sun, 15 Apr 2018 12:48:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7h5P-0001nA-Pz for pgsql-general@lists.postgresql.org; Sun, 15 Apr 2018 12:48:53 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7h5K-0006dx-RD for pgsql-general@lists.postgresql.org; Sun, 15 Apr 2018 12:48:51 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 57E0D20BBD; Sun, 15 Apr 2018 08:48:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 15 Apr 2018 08:48:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=kqAnv4DSfJDwFFfaDFojOkNoNGvGb0/vSR7jLskvn2g=; b=OjUSU8k7 Iu1lQkN0DLLb/dQh/MuQRvjtYextZOOzMNnTsBeOaON/tMk4by3NgnrzBNax6HD9 xl2OnsJP3zoEbfEx+yMxncKiqXhmQ5tzKh/grlxNbGhjLa4kKRMUWBCxIfTqXtUR tXIYacdDmtD0yLnQNezaNxZa/M2v3+1FnxHRn3PbunaYqwRC5pE8LYn17fNomjHL wLgEu4X+whmQEwqszaG++V8/YXlopu9J3Chi78zrADnNQYu/2wgzxwnyZvcfh6I4 4K5uP7HuBr95DpOj6X9Pmx9CrWKtNe0/qVWwtX/z8rwxRBm2UkiqzMG/M9tF0LDP px91D4md+DwxwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=kqAnv4DSfJDwFFfaDFojOkNoNGvGb 0/vSR7jLskvn2g=; b=SmzrMtJWL1TJIecM0g5RG+Hnl1g8BYorki0B2Gjqmvh44 woFijrutaDBD9APqfaejQ33rTnZnmg2LqQpqIISFRFESWMyDf1V9ujlYBdLk3A2o /Tt/jYv0K7k8GK8hR4XxmI/N8KoJL48vqOPBSmDjtrnnntTAro6dboaAG0J5dPE2 0RfEXiqW/lCWkB0zX/OeKk0Hn/MhxbtqCrs+SaPg5F0U7mpIvMYwgVxoOKi6LjM6 7cDQ2gRTrDoqRwAGny63CU8Tp6MU1c5AeIcqT6w3ak7rd6uhgol6gvZAsH3ERzqE ploNMFIWee/6RBHjQ3xC29jtdXPG+01u07/jx3uPg== X-ME-Sender: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id C0AA210253; Sun, 15 Apr 2018 08:48:42 -0400 (EDT) Date: Sun, 15 Apr 2018 21:48:34 +0900 From: Michael Paquier To: A A Cc: "pgsql-general@lists.postgresql.org" Subject: Re: Can a broken Postgresql data directory be reconstructed without losing data? Message-ID: <20180415124834.GA21024@paquier.xyz> References: <22260152.420560.1523780705996.ref@mail.yahoo.com> <22260152.420560.1523780705996@mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jI8keyz6grp/JLjh" Content-Disposition: inline In-Reply-To: <22260152.420560.1523780705996@mail.yahoo.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --jI8keyz6grp/JLjh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Apr 15, 2018 at 08:25:05AM +0000, A A wrote: > I'm trying to restore a database from a broken data directory that > have lost many of its files accidentally. Let me guess, a wild set of rm commands? > I have tried unsuccessfully to install new instance of the same > Postgresql version and then copy (with overwrite) the broken datadir > to the new one.here the remaining datadir that I'm working on : This is the kind of things I have found myself doing some times, as well as some people on this list, and this enters in the category of horror stories. So the answer to the question "Can I work on a broken data folder and save as much data as possible?" is "yes". However this enters in the field of dark magics as this requires advanced skills and knowledge of PostgreSQL, including its internals, its folder structure, and ways to bypass some protocols or even perhaps patch the upstream code to bypass some checks to the data you are looking for... Additionally, this is usually a step-by-step and case-by-case problem. Please note that data deleted is gone. You may be able to get back some data from the file system which has been deleted, though this requires a special set of skills and luck. Hiring a professional is recommended for such operations. -- Michael --jI8keyz6grp/JLjh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlrTSiIACgkQnvQgOdby QH13yg/+MD6GV7MiFZ9HGQIzf3PfipXuO2ZdshziYhHcFu2gVJs6+UMdu9Puxw4o rpeVyEYdfUAoya33ZH8bLp4OETdg9T/jzZ/NeALM+duQiH5Rlo2MNUnpVEnQXXw9 o4MQoHCB/V/b1ALThSvOxfxUgV3Ry6hL7NmN+Xw/HZVfa4Vsx8tebqYocuCsAqkt v9+QIPtVQjDAC91FDVh34P/mkcOfr7f6wtYWzG07hloRDvDhkFxLK9BTzli7BHw9 O69LJtj5QNU3HQQQKev7i8aIrY6/TmdBJS1yWluY8LIU2gC9rdKWgilYPZgjaZ2E OesKyByLSbMa3l8XoSm0HbdCoOn6OTl1JVbaTXZSkH/nKbu6h47R3fjAo2qTWPEL ssrX0e2C83WAPyajfPkEhjxxQokCthezTVnzWTlsEKxZ2k7M8qah1BZ3X2gwiJXN Aro9epnhkj3PbxLcV6eX9CH2NTRRwzs7wB5p4s66vjx8djk4yg9Z2ET9GGSneozt VRUtO2lxr/PvYLC0wFfUS80A71Td5XzZbD1QYqSFuxxZnl43CPpiqdALvSoTAvCT 43BN1Lr8wLiFlEMVKkoaAcFHjRb+GTuYq6iqSOU8rNVHlrFwc/oVdMwPUgHf/CxB 5lLMAu/nrX41HNb/2mSn8qjD3t6Jyy2Ts045X4wg+ol3I+sAQLk= =qfsr -----END PGP SIGNATURE----- --jI8keyz6grp/JLjh--