Postgresql 在Mac外部硬盘上创建Postgres tablepsace
我正在尝试在外部磁盘上为Postgres创建一个表空间(SSD通过TB3连接) 磁盘的安装方式如下: /dev/disk3s1 on/Volumes/External2TB(apfs、本地、nodev、nosuid、日志) 请注意,我已经禁用了“忽略所有权”选项(noowners),因为我认为这可能会导致权限问题,因为postgres使用自己的用户ID运行。 我希望表空间位于/Columes/External2TB/PostgreSQL/space2中 我有:Postgresql 在Mac外部硬盘上创建Postgres tablepsace,postgresql,macos,unix,file-permissions,permission-denied,Postgresql,Macos,Unix,File Permissions,Permission Denied,我正在尝试在外部磁盘上为Postgres创建一个表空间(SSD通过TB3连接) 磁盘的安装方式如下: /dev/disk3s1 on/Volumes/External2TB(apfs、本地、nodev、nosuid、日志) 请注意,我已经禁用了“忽略所有权”选项(noowners),因为我认为这可能会导致权限问题,因为postgres使用自己的用户ID运行。 我希望表空间位于/Columes/External2TB/PostgreSQL/space2中 我有: $ ls -lad /Volume
$ ls -lad /Volumes/External2TB/PostgreSQL/
drwxr-xr-x 3 postgres daemon 96 Apr 19 01:11 /Volumes/External2TB/PostgreSQL/
及
postgres:daemon实际上是运行postgres进程的uid:gid
我以用户postgres的身份与psql连接,我得到:
postgres=# create tablespace space2 location '/Volumes/External2TB/PostgreSQL/space2';
ERROR: could not set permissions on directory "/Volumes/External2TB/PostgreSQL/space2": Operation not permitted
我可以以postgres用户的身份运行一个shell,并在/Volumes/External2TB/PostgreSQL/space2上执行chmod,因此我完全不知道为什么postgres进程无法做到这一点……运行strace或其他类似的Mac程序来跟踪PostgreSQL server进程的系统调用,并查看哪一个失败以及为什么失败。如果计划分离磁盘,请不要在外部磁盘上创建表空间。这将破坏PostgreSQL数据库。外部磁盘上的文件系统是什么?
postgres=# create tablespace space2 location '/Volumes/External2TB/PostgreSQL/space2';
ERROR: could not set permissions on directory "/Volumes/External2TB/PostgreSQL/space2": Operation not permitted