Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question
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. –  Nerdling Sep 27 '09 at 21:05
add comment

3 Answers 3

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.

share|improve this answer
    
I can't install on the same architecture... I've not other alternative ? –  Kevin Campion Sep 27 '09 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? –  user13185 Sep 28 '09 at 18:06
add comment

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.

share|improve this answer
add comment
up vote 0 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.