Thread: need help with rebuilding postgresql

need help with rebuilding postgresql

From
jooy
Date:
Hello all,
We have a serious problem. Out dedicated server was hacked last
Sunday. And technical support used a new hard drive with new-installed
centOS to build our new server. Unfortunately, we don't have database
backup(pg_dump). We only have the old drive mounted and access normal
files. Is there any way we can just use those files to restore the
database? If we can, How? Any input are extremely welcome.

Thanks,
Leroy

Re: need help with rebuilding postgresql

From
Richard Huxton
Date:
jooy wrote:
> Hello all,
> We have a serious problem. Out dedicated server was hacked last
> Sunday. And technical support used a new hard drive with new-installed
> centOS to build our new server. Unfortunately, we don't have database
> backup(pg_dump). We only have the old drive mounted and access normal
> files. Is there any way we can just use those files to restore the
> database? If we can, How? Any input are extremely welcome.

You need an old copy of Postgesql - the same version you previously had.
It should also have the same build-options. The simplest solution would
probably be to do a minimal install of your old O.S. (a previous version
of CentOS) and then the relevant version of PostgreSQL.

If there's an RPM with the right version of PostgreSQL for your current
CentOS, you could try that, but take a filesystem backup first.

--
   Richard Huxton
   Archonet Ltd

Re: need help with rebuilding postgresql

From
jooy
Date:
Thanks so much. We now have CentOS and postgresql ready. But we are
missing the backup files, that's, we haven't done pg_dump our
database. How to restore the database from some files like using mdb
file to restore a Access database? Is it possible in Postgres? I am
new to Postgres. Your help will be appreciated.
jooy

On 10/16/07, Richard Huxton <dev@archonet.com> wrote:
> jooy wrote:
> > Hello all,
> > We have a serious problem. Out dedicated server was hacked last
> > Sunday. And technical support used a new hard drive with new-installed
> > centOS to build our new server. Unfortunately, we don't have database
> > backup(pg_dump). We only have the old drive mounted and access normal
> > files. Is there any way we can just use those files to restore the
> > database? If we can, How? Any input are extremely welcome.
>
> You need an old copy of Postgesql - the same version you previously had.
> It should also have the same build-options. The simplest solution would
> probably be to do a minimal install of your old O.S. (a previous version
> of CentOS) and then the relevant version of PostgreSQL.
>
> If there's an RPM with the right version of PostgreSQL for your current
> CentOS, you could try that, but take a filesystem backup first.
>
> --
>   Richard Huxton
>   Archonet Ltd
>

Re: need help with rebuilding postgresql

From
"Scott Marlowe"
Date:
On 10/16/07, jooy <oldatum@gmail.com> wrote:
> On 10/16/07, Richard Huxton <dev@archonet.com> wrote:
> > jooy wrote:
> > > Hello all,
> > > We have a serious problem. Out dedicated server was hacked last
> > > Sunday. And technical support used a new hard drive with new-installed
> > > centOS to build our new server. Unfortunately, we don't have database
> > > backup(pg_dump). We only have the old drive mounted and access normal
> > > files. Is there any way we can just use those files to restore the
> > > database? If we can, How? Any input are extremely welcome.
> >
> > You need an old copy of Postgesql - the same version you previously had.
> > It should also have the same build-options. The simplest solution would
> > probably be to do a minimal install of your old O.S. (a previous version
> > of CentOS) and then the relevant version of PostgreSQL.
> >
> > If there's an RPM with the right version of PostgreSQL for your current
> > CentOS, you could try that, but take a filesystem backup first.
>
> Thanks so much. We now have CentOS and postgresql ready. But we are
> missing the backup files, that's, we haven't done pg_dump our
> database. How to restore the database from some files like using mdb
> file to restore a Access database? Is it possible in Postgres? I am
> new to Postgres. Your help will be appreciated.

I think you misunderstand.  He's saying to make a FILE system backup
of what's there now (i.e. cp -rp /where/my/db/is/now
/where/i/backup/files) before trying to bring up a postgresql instance
on the files as they are now.

Re: need help with rebuilding postgresql

From
jooy
Date:
Thanks for the input. Let me put it in this way:We are running a php
site over postgresql database server. The name of database instance is
FOIM. All of a sudden after Sunday, some guy hacked the system. We
need rebuild the system. Now we have new-installed OS along with
Postgres 7. Unfortunately, we don't have backup of database( we don't
pg_dump FOIM). But we have a old hard drive which contains all files.
Is it possible that we restore the FOIMl over file system level?
-thanks
jooy

On 10/16/07, Scott Marlowe <scott.marlowe@gmail.com> wrote:
> On 10/16/07, jooy <oldatum@gmail.com> wrote:
> > On 10/16/07, Richard Huxton <dev@archonet.com> wrote:
> > > jooy wrote:
> > > > Hello all,
> > > > We have a serious problem. Out dedicated server was hacked last
> > > > Sunday. And technical support used a new hard drive with new-installed
> > > > centOS to build our new server. Unfortunately, we don't have database
> > > > backup(pg_dump). We only have the old drive mounted and access normal
> > > > files. Is there any way we can just use those files to restore the
> > > > database? If we can, How? Any input are extremely welcome.
> > >
> > > You need an old copy of Postgesql - the same version you previously had.
> > > It should also have the same build-options. The simplest solution would
> > > probably be to do a minimal install of your old O.S. (a previous version
> > > of CentOS) and then the relevant version of PostgreSQL.
> > >
> > > If there's an RPM with the right version of PostgreSQL for your current
> > > CentOS, you could try that, but take a filesystem backup first.
> >
> > Thanks so much. We now have CentOS and postgresql ready. But we are
> > missing the backup files, that's, we haven't done pg_dump our
> > database. How to restore the database from some files like using mdb
> > file to restore a Access database? Is it possible in Postgres? I am
> > new to Postgres. Your help will be appreciated.
>
> I think you misunderstand.  He's saying to make a FILE system backup
> of what's there now (i.e. cp -rp /where/my/db/is/now
> /where/i/backup/files) before trying to bring up a postgresql instance
> on the files as they are now.
>

Re: need help with rebuilding postgresql

From
"Scott Marlowe"
Date:
On 10/16/07, jooy <oldatum@gmail.com> wrote:
> Thanks for the input. Let me put it in this way:We are running a php
> site over postgresql database server. The name of database instance is
> FOIM. All of a sudden after Sunday, some guy hacked the system. We
> need rebuild the system. Now we have new-installed OS along with
> Postgres 7. Unfortunately, we don't have backup of database( we don't
> pg_dump FOIM). But we have a old hard drive which contains all files.
> Is it possible that we restore the FOIMl over file system level?
> -thanks

Yes, that's what we've been saying to do.

Copy the data off of the old drive onto your new machine in the same
place.  For a RH install of PG7.4 that will be in the /var/lib/pgsql
directory I believe.  Make sure everything in the dir is owned by
postgres on the new machine, and the perm on the /var/lib/pgsql dir is
0700 and try to start up the db (sudo /sbin/service postgresql start
for an rpm install)