Server Fault is a question and answer site for system and network administrators. 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 database on a hard drive from a computer whose motherboard died. The HD is fine.

I'm trying to XCOPY the data directory and overwrite the contents of a Postgres 8.4 data directory on another computer.

I'm getting Access Denied. I have verified that the Postgres service is stopped. The target computer has 2 user accounts, one of which is "Postgres" which the Postgres install created. I have tried this logging in with similar results using both accounts.

Any ideas or even an alternate approach much appreciated.

share|improve this question

If I understand you correctly you want to clone the PGDATA directory from one system to another, where the target system already has a PGDATA directory (with some contents).

In this case I would suggest the following:

  1. Stop Postgres on (on both systems - though in your case only the target matters)
  2. Move/Rename the directory on the target system so it's out of the way
    (You don't want cruft from the target's PGDATA directory hanging around when the copy is done)
  3. Copy the PGDATA directory from the source machine to the target machine
  4. Adjust any configuration files that need to be adjusted, and start Postgres on the target.

This should also avoid any problems with processes holding files open in the old data directory, as it's been moved aside.

The usual caveats about copying PGDATA from one host to another apply: Make sure you're using the same version of Postgres (or at least a compatible one), built for the same architecture/with the same options, that all extensions match up, etc...

share|improve this answer

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.