Thread: Emergency backup question.

Emergency backup question.

From
Danni Coy
Date:
Greetings Basically I have a problem here. I lost my linux system due to
hard drive corruption I managed to back up my /var/lib/pgsql/data/base
directory to an ordinary tarball before I redid the system. Is there any
way to use this data as a backup?
and what is the proceedure for a proper backup?


Re: Emergency backup question.

From
"Duncan Adams (DNS)"
Date:
I guess one could try pg_dump but I am still a green eared newbie so don't
take my word for it.

-----Original Message-----
From: Danni Coy [mailto:rgcoy@midcoast.com.au]
Sent: Thursday, November 22, 2001 8:15 PM
To: pgsql-novice@postgresql.org
Subject: [NOVICE] Emergency backup question.


Greetings Basically I have a problem here. I lost my linux system due to
hard drive corruption I managed to back up my /var/lib/pgsql/data/base
directory to an ordinary tarball before I redid the system. Is there any
way to use this data as a backup?
and what is the proceedure for a proper backup?


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Re: Emergency backup question.

From
Tom Lane
Date:
Danni Coy <rgcoy@midcoast.com.au> writes:
> Greetings Basically I have a problem here. I lost my linux system due to
> hard drive corruption I managed to back up my /var/lib/pgsql/data/base
> directory to an ordinary tarball before I redid the system. Is there any
> way to use this data as a backup?

If you only backed up that subdirectory, and not all of
/var/lib/pgsql/data, I'm afraid you're out of luck.  You needed the
pg_log files too.

> and what is the proceedure for a proper backup?

Routine pg_dump runs are recommended.  You might care to consult the
discussion of backup procedures in the Administrator's Guide,
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/backup.html
or the updated version in development docs,
http://candle.pha.pa.us/main/writings/pgsql/sgml/backup.html

            regards, tom lane

Re: Emergency backup question.

From
"Josh Berkus"
Date:
Danni,

> > Greetings Basically I have a problem here. I lost my linux system
> due to
> > hard drive corruption I managed to back up my
> /var/lib/pgsql/data/base
> > directory to an ordinary tarball before I redid the system. Is
> there any
> > way to use this data as a backup?

Not really.  As Tom said, without some of the other files, a backup of
just the /base subdirectory is nigh on useless.

If, however, this was mission-critical information requiring many hours
of your time to recover, you can recover a certain amount of your data
by reading the tables directly using a text editor.   However, this is
very labor-intensive and tends to only allow you to recover the integer,
numeric, and short VARCHAR fields; the rest of the fields often get
compressed.

-Josh


______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

Re: Emergency backup question.

From
Brian
Date:
My take on the documentation that I just read is that you have a filesystem backup of the data if you have everything
atand below the pgsql/data directory... 

---- to quote the docs --------

An alternative backup strategy is to directly copy the files that Postgres uses to store the data in the database. In
Section3.2 it is explained where these files are located, but you have probably found them already if you are
interestedin this method. You can use whatever method you prefer for doing usual file system backups, for example  

tar -cf backup.tar /usr/local/pgsql/data

There are two restrictions, however, which make this method impractical, or at least inferior to the pg_dump method:

The database server must be shut down in order to get a usable backup. Half-way measures such as disallowing all
connectionswill not work as there is always some buffering going on. For this reason it is also not advisable to trust
filesystems that claim to support "consistent snapshots". Information about stopping the server can be found in Section
3.6. 

Needless to say that you also need to shut down the server before restoring the data.

-- end quote --------

At 05:15 AM 11/23/01 +1100, Danni Coy wrote:
>Greetings Basically I have a problem here. I lost my linux system due to
>hard drive corruption I managed to back up my /var/lib/pgsql/data/base
>directory to an ordinary tarball before I redid the system. Is there any
>way to use this data as a backup?
>and what is the proceedure for a proper backup?
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>