I'm trying to migrate a PostgreSQL 9.5 database to a larger disk E on a Windows 2008 Server. After stopping the service I initially tried copying the the data
folder to the new disk and then changed the PostgreSQL Service's executable path using
sc config postgresql-x64-9.5 binPath= "\"C:\Program Files\PostgreSQL\9.5\bin\pg_ctl.exe\" runservice -N \"postgresql-x64-9.5\" -D \"E:\pg_db\data\" -w"
I changed the permissions on the data
folder to include "Network Services" by right-clicking on the folder and going Properties
. Under the Security
Tab click "Edit...
" and then "Add...
". Type "Network Service
" and then click "Check Names
" and then OK
.
But when I hit Start in Services, the following error message appears under the Windows Event Viewer:
FATAL: data directory "E:/pg_db/data" does not exist.
I even tried creating a new data directory from the administrator cmd
prompt using instructions here but eventually got the same error.
I see one of the answers to the "Similar Questions" as I'm writing this is "It is easier if you reinstall Postgre and select data folder during install." That can't be the best we can do.
EDT FATAL: data directory "E:/pg_db/data" does not exist
againsc config ...
because that sets the right user for the postgres Service