Thread: Is it possible to import raw data directories in a cluster (Debian)?

Is it possible to import raw data directories in a cluster (Debian)?

From
Joost Kraaijeveld
Date:
Hi,

During an upgrade of by customer he managed to drop the original cluster
as the first step. As soon as he saw his error he broke off the
pg_dropcluster by ctrl-c. Of course he has no useful backups, But it
appears that the directories of the database he wants to restore are
still on disk and untouched by his upgrade.

Is it possible to import the data in the directories somehow so that
they are fully functional databases?

TIA


--
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl

Attachment

Re: Is it possible to import raw data directories in a cluster (Debian)?

From
Joost Kraaijeveld
Date:
An addition to the previous post:

In an attempt to repair the damage he reinstalled Postgresql 9.0 and now
has a running 9.0 with ~ 10 database in the ../9.0/base directory

--
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl

Attachment

Re: Is it possible to import raw data directories in a cluster (Debian)?

From
"Kevin Grittner"
Date:
Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl> wrote:

> During an upgrade of by customer he managed to drop the original
> cluster as the first step. As soon as he saw his error he broke
> off the pg_dropcluster by ctrl-c.

pg_dropcluster is not something provided by the PostgreSQL
community; it seems to be part of the Debian (and related)
distributions.  How to recover from an aborted execution of it might
be better directed to the provider, as they may have a better
understanding of the software.

In any event, if the files are recovered to their original
locations, the database should start.

> Of course he has no useful backups,

That should never be an "of course" -- given that hardware can
catastrophically fail at any time, anyone who values their data
should have regular backups with regular tests that the backups can
actually be restored to a working database cluster.

Whether your data is in a database or is a collection of word
processing documents and spreadsheets, this is a fundamental aspect of
using computers.

> But it appears that the directories of the database he wants to
> restore are still on disk and untouched by his upgrade.

What upgrade?  I thought you said that pg_dropcluster was what was
run?  When you say the directories are "untouched" does that mean
that no files have been deleted from them?

> Is it possible to import the data in the directories somehow so
> that they are fully functional databases?

Import?  From what?  From the earlier parts of your post it sounded
like you need someone who knows the OS and its utilities to see if
they can recover deleted files.  If you can recover them to the
directories from which they were deleted, I would expect the
database cluster to start right up.

-Kevin

Re: Is it possible to import raw data directories in a cluster (Debian)?

From
Joost Kraaijeveld
Date:
On Wed, 2011-09-07 at 10:08 -0500, Kevin Grittner wrote:
> In any event, if the files are recovered to their original
> locations, the database should start.
I think that he lost the postgres database in the proces, which seems to
hold the information for every database in the cluster.

> > Of course he has no useful backups,
>
> That should never be an "of course"
I should have marked the cynical mode a bit more clear ;-)

> What upgrade?
See the cynical remark above.

> I thought you said that pg_dropcluster was what was
> run?  When you say the directories are "untouched" does that mean
> that no files have been deleted from them?
Apart from the postgres and template* databases...

> Import?  From what?  From the earlier parts of your post it sounded
> like you need someone who knows the OS and its utilities to see if
> they can recover deleted files.  If you can recover them to the
> directories from which they were deleted, I would expect the
> database cluster to start right up.
Mmmmm. Than he has a problem. XFS does not support undelete.

Thanks for the answer.

--
Met vriendelijke groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl



Re: Is it possible to import raw data directories in a cluster (Debian)?

From
"Kevin Grittner"
Date:
Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl> wrote:

>> I thought you said that pg_dropcluster was what was
>> run?  When you say the directories are "untouched" does that mean
>> that no files have been deleted from them?
> Apart from the postgres and template* databases...

Ah, if the directories containing the data had not yet been touched,
an expert might be able to extract the data.  It would take a lot of
skill and a lot of time (read "not inexpensive to do"), but if
you're right about the files being there in the application
database(s), it might be done.

-Kevin