Tuesday, April 13, 2010

Disk full : Moving a Postgresql database data folder

For testing purposes, I set up a Postgresql 8.3 database on a Windows machine. The hard drive space was too little for the use, so I had to move the data folder to another location. (I could not use the saving mechanisms because the remaining space was not big enough even for the temporary files required for the operation.)

This proved to be quite easy. However, you cannot keep the database running.
  1. You first stop the database service from the Windows from the Computer Management console,
  2. Then move the data folder to a new location with more space,
  3. Then modify the path in the config file postmaster.opts, in the data folder itself,
  4. Then modify the path that's given to the service when it's launched by Windows : in the registry, edit the ImagePath string at key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pgsql-8.3
  5. Then restart the database service from the Computer Management console.

2 comments:

  1. There are live replication systems for postgresql 8.3 on linux.
    Maybe there are some on windows ?

    ReplyDelete
  2. Seems the Slony-I tool has been ported to Windows. If I have another chance, I'll test it.

    ReplyDelete

I can read French, English, German and Romanian, please feel free to write in whichever language you prefer.