HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

PostgreSQL data directory/files portability

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postgresqldirectoryfilesdataportability

Problem

I have lost my PostgreSQL 9.1 installation on my Ubuntu machine by update to Ubuntu 14.10. Now I have no (reasonably easy) way to export the data from my PostgreSQL 9.1 database. Is it possible to take the data directory from the Ubuntu machine, put it to a Windows machine and have Windows version of PostgreSQL 9.1 use it so that I can dump it?

Solution

The best option is probably to install PostgreSQL 9.1 from http://apt.postgresql.org/ if it's available for your distro/version.

If not, you can install a temporary copy of your old Ubuntu version in a VM for recovery purposes - use virtualbox, kvm, etc. Vagrant can make life easier, just grab a prebuilt Ubuntu box from https://vagrantcloud.com/search?utf8=%E2%9C%93&sort=&provider=&q=ubuntu , bring it up, restore your DB, dump it, and shut the box down again.

A PostgreSQL data directory from Linux is not compatible with PostgreSQL on Windows. So you cannot use a 9.1 install on Windows to restore your data from Linux.

Once you've recovered, set up regular backups.

Context

StackExchange Database Administrators Q#81469, answer score: 3

Revisions (0)

No revisions yet.