reuse data in existing data directory

Started by Peter Schmidtkeabout 16 years ago3 messagesgeneral
Jump to latest
#1Peter Schmidtke
pschmidtke@mmb.pcb.ub.es

Dear PostGreSQL users,

I have the following problem. I have a system with several partitions
(openSuse Linux 11.1). Far what is important related to this question :

- 1 system partition (where postgres is installed)
- 1 data partition (where the postgres data directory is lying)

my system partition got messed up and I prefer to reformat and reinstall
the system without touching to the data partition. Thus I have to reinstall
postgresql, but I don't know if I would be able to recover my data. Is that
possible? How can I reintegrate all my ancient databases?

Thanks in advance.

--

Peter Schmidtke

----------------------
PhD Student at the Molecular Modeling and Bioinformatics Group
Dep. Physical Chemistry
Faculty of Pharmacy
University of Barcelona

#2Richard Huxton
dev@archonet.com
In reply to: Peter Schmidtke (#1)
Re: reuse data in existing data directory

On 16/03/10 12:02, Peter Schmidtke wrote:

Dear PostGreSQL users,

I have the following problem. I have a system with several partitions
(openSuse Linux 11.1). Far what is important related to this question :

- 1 system partition (where postgres is installed)
- 1 data partition (where the postgres data directory is lying)

my system partition got messed up and I prefer to reformat and reinstall
the system without touching to the data partition. Thus I have to reinstall
postgresql, but I don't know if I would be able to recover my data. Is that
possible? How can I reintegrate all my ancient databases?

If the data partition contains *all* of your PostgreSQL data files
(pg_clog, pg_xlog etc) then it should be simple enough.

1. Take a backup of your PG data (can't hurt).
2. Re-install SuSe, make sure you have the same version of PostgreSQL
(if you had 8.3 before re-install that 8.3 again).
3. If your PG files are in the standard directory then you should see an
error saying initdb refused to run.
4. That's it - it should all just work.

--
Richard Huxton
Archonet Ltd

#3Peter Schmidtke
pschmidtke@mmb.pcb.ub.es
In reply to: Richard Huxton (#2)
Re: reuse data in existing data directory

Thanks Richard,

in fact I just had to run the manual install of postgres and define the
data directory to my existing one and everything was restored....great, but
I preferred to ask rather than erasing my data ;)

Thanks

Peter

On Tue, 16 Mar 2010 12:24:41 +0000, Richard Huxton <dev@archonet.com>
wrote:

On 16/03/10 12:02, Peter Schmidtke wrote:

Dear PostGreSQL users,

I have the following problem. I have a system with several partitions
(openSuse Linux 11.1). Far what is important related to this question :

- 1 system partition (where postgres is installed)
- 1 data partition (where the postgres data directory is lying)

my system partition got messed up and I prefer to reformat and reinstall
the system without touching to the data partition. Thus I have to
reinstall
postgresql, but I don't know if I would be able to recover my data. Is
that
possible? How can I reintegrate all my ancient databases?

If the data partition contains *all* of your PostgreSQL data files
(pg_clog, pg_xlog etc) then it should be simple enough.

1. Take a backup of your PG data (can't hurt).
2. Re-install SuSe, make sure you have the same version of PostgreSQL
(if you had 8.3 before re-install that 8.3 again).
3. If your PG files are in the standard directory then you should see an
error saying initdb refused to run.
4. That's it - it should all just work.

--
Richard Huxton
Archonet Ltd

--

Peter Schmidtke

----------------------
PhD Student at the Molecular Modeling and Bioinformatics Group
Dep. Physical Chemistry
Faculty of Pharmacy
University of Barcelona