My server is Windows Server 2016. The server mounted a NFS remote storage with below command:

mount \\\nfsshare z:
mkdir z:\pg_data

All the relevant permissions such as read/write/execute were set correctly on z:

I installed PostgreSQL 12.3 to C:\PostgreSQL. And then created tablespace with below commands:

create tablespace my_db_space location 'z:\pg_data'

PostgreSQL replied me:

Error, directory 'z:\pg_data' does not exist.

I also tried 'z:\pg_data', 'z:/pg_data', but all got the same error message.

I also tried another way, which is, I installed PostgreSQL in Z:\postgresql. The installation was successful. but postgreSQL service failed to start because of the error "directory not found".

In Linux, the same situation didn't happen the same error.

It seems that on Windows, PostgreSQL can only use local storage as its data location, right?

Any siggestion ?

  • 1
    Do not do that. Even if it did work, this is a sure way of corrupting your database. Don't do it.
    – user1822
    Commented Aug 11, 2020 at 10:00

1 Answer 1


It seems that on Windows, PostgreSQL can only use local storage as its data location, right?

On any operating system, PostgreSQL should only use "local" file systems.
On Linux, those file systems can be mounted from other machines in a way that PostgreSQL is not aware of so things "just work".

On Windows, a network drive is another thing entirely.

Under which account are you running PostgreSQL? (Probably as a Windows Service under "Local System").

Does that account have the ability to "see" anything not on the local machine ("No").

Even if you were to change this, putting your data "further" from the process that needs to manipulate it is just asking for [major] Trouble.

  • I tried local system account and network service account, PostgreSQL responded the same error. I think the both accounts can see the folder because if the permissions were not set enough, PostgreSQL will report error for permission denied.
    – wureka
    Commented Aug 12, 2020 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.