1

When I try to recover PostgreSQL database from a backup saved under my old version of Mac Os X 10.5 (32bits) on my new version 10.6 (64bits), I have this error :

# sudo -u postgres /opt/local/lib/postgresql82/bin/postgres -D defaultdb_backup FATAL: incorrect checksum in control file 

This was due to the one server running a 32 bit version and the other one running a 64 bit.

How do I recover my old data ?

1
  • 1
    The database itself isn't a backup; dumping it out would allow you to recover in a different environment, such as the one you've switched to. Commented Sep 27, 2009 at 21:05

3 Answers 3

2

Install somewhere postgres in exactly the same version as before, on same architecture, compiles with the same options, then you can recover. doing backups by writing wal segments and/or copying data directory is not really portable.

2
  • I can't install on the same architecture... I've not other alternative ? Commented Sep 27, 2009 at 18:22
  • yes. load data from pg_dump output. otherwise you're hosed. what made you make a backup of files in their binary, architecture-and-compile-options-dependent format? Commented Sep 28, 2009 at 18:06
1

As depesz said you will need to compile a 32bit version of Postgres to import the backup. You should be able to get the installer from the Postgres website and run the 32 bit version temporarily, even on a 64bit install of OS X.

As an aside, in the future when doing backups I MUCH prefer using pg_dump --clean to get a full dump from the database. You can use a pg_dump --clean file on any version of postgres.

1

I found how to recover my datas.

The postgresql executable is in 64 bits :

# file /opt/local/lib/postgresql82/bin/postgres /opt/local/lib/postgresql82/bin/postgres: Mach-O 64-bit executable x86_64 

I verify the postgresql executable in my backup is in 32 bits :

# file /Volumes/Backup/Backups.backupdb/MyMacBook/2009-09-23-004611/Macintosh\ HD/opt/local/lib/postgresql82/bin/postgres /Volumes/Backup/Backups.backupdb/MyMacBook/2009-09-23-004611/Macintosh HD/opt/local/lib/postgresql82/bin/postgres: Mach-O executable i386 

I copy it on my system :

# sudo cp /Volumes/Backup/Backups.backupdb/MyMacBook/2009-09-23-004611/Macintosh\ HD/opt/local/lib/postgresql82/bin/postgres /opt/local/lib/postgresql82/bin/postgres_32 

And now when I do :

# sudo -u postgres /opt/local/lib/postgresql82/bin/postgres_32 -D defaultdb_backup 

It works !

Thank you all

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.