Postgresql – Linux PostgreSQL mount data from external ntfs disk

database-designfile systemlinuxpostgresqlwindows

I have similar problem as here: Postgres tablespace on mounted usb

I want to have access to my DB on external hard drive from Raspbian and Windows 10. Not simultaneously. I just want cross-platform DB on my external disk, which is accessible for both Windows and Raspberry (Linux). So, if I connect disk with DB to Windows or Raspberry Postgres in that OS could access DB.

I have PostgreSQL 11.11 on Raspbian and same version on Windows 10 x64.

My DB is on external hard drive with NTFS file system. It was created during installation of PostgreSQL on Windows.
So on Windows everything works fine. But I can't access my database from raspian. I managed to edit fstab to connect my external hard drive as postgres user, therefore postgres config and data have same owner (postgres:postgres). First, I mounted external disk with umask=0000, but PostgreSQL said that the rights/permissions are wrong and they should be 0700 or 0750. After remounting external disk with 750, PostgreSQL says pg_ctl can't access my external disk.

As I see, it is impossible to access DB on NTFS disk from Linux. Is there a way to solve my problem? Will FAT32 work for both OSes?

Best Answer

I want to have access to my DB on external hard drive from Raspbian and Windows 10.

First things first:

Database != File 

You absolutely cannot have two, running, Postgres clusters accessing the same data files at the same time. The only DBMS I know of that can do anything like that is the super-complicated and super-expensive Oracle RAC!
Building a system where there is even the remotest chance of that happening is on the road to disaster.

Portability is a "Nice to Have".
Resilience and Data Integrity are essential.

I would recommend that you set up one of your machines as the "server", with the Postgres cluster running on it, and connect to that from the other, "client" machine.