Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a new computer that is replacing an old machine that has PostGIS installed.

The old computer has a 2nd hard drive where the PostGIS data directory is stored. I want to move this drive over to the new computer and continue to use it for data storage.

Can I install the 2nd hard drive in the new machine and when installing PostGIS point it to the data directory on this hard drive and everything will work?

Or do I have to back my database up and restore it?

PostGIS on the old and new machines are the same version (2.0 on PostgreSQL 9.1), the operating systems are windows xp (32 bit) vs windows 7 (64 bit).

share|improve this question
go ahead, I would be very surprised if it didn't just work. The data is stored in a bitness-agnostic way or you wouldn't be able to access it from mixed hosts. – lynxlynxlynx Jun 13 '12 at 8:11
The preceding comment is wrong. You can access the database from mixed hosts because the network protocol is agnostic, not because the on-disk formats are. – Paul Ramsey Jun 13 '12 at 16:55
up vote 3 down vote accepted

Yes, IF:

  • The new computer is the same architecture (i386, x64) as the old one
  • The new computer is running the same major.minor version of PostgreSQL as the old one
  • The new computer is running the same major version of PostGIS
share|improve this answer
Thanks for the response. So the answer in my situation is no as the new computer is 64bit and the old one 32bit. – James S Jun 14 '12 at 8:09
Are you sure this still fails if you use the 32 bit PostgreSQL/PostGIS on the 64 bit machine? The mailing list suggests otherwise, although it does seem to suggest that dump/restore is just a better idea, anyway. – jpmc26 Aug 27 '14 at 7:25

Naturally you back up your database on a regular basis, so it should be a simple case of restoring from the last backup. PostgreSQL also has cool features that allow live swapping of a production database using the Write Ahead Logging system and some very clever thinking.

That said, if for some reason your backups aren't up to date, or gasp non existent, simply putting in the 2nd drive into the new computer, pointing the PGDATA environment variable to the right place, and restarting the server will work. As @lynxlynxlynx said, the processor architecture shouldn't matter for precisely this reason, but it never hurts to back up your data.

See the PostgreSQL docs here and here for more information.

Oh, did I mention you should back up your data regularly? :)

share|improve this answer
Thanks for the response. I do back my data up regularly yes - thanks for the reminder though. I just asked as I will be using the same hard drive in the new machine so it seemed like it would be easier to just use the same disk without needing to restore. – James S Jun 13 '12 at 9:20

Your Answer


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.