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?

  • 2
    Don't try to do that. If you succeed, you will probably end up with data corruption. Mar 31 '21 at 11:24
  • I would try on FAT32. But I'm not sure that the on-disk format is identical for both OSes. Apr 18 '21 at 10:22

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.

  • I don't want to have two running. I am developing in Windows for Raspberry and I want to test my program. So I disconnect my disk with BD from Windows and connect it to raspberry. I just want raspberry to have access to this BD.
    – PAXMA
    Mar 31 '21 at 12:29

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