postgres不能创建集群作为根?

时间:2018-12-28 17:11:07

标签: postgresql

因此,在使用pg_createcluster在外部驱动器上的postgresql中创建数据集群时遇到了麻烦。我使用的是Ubuntu 16.04,我的用户在此文件夹上拥有rwx,但仍然出现权限错误。

这是我运行的命令:

yuqiong@yuqiong-G7-7588:/media/yuqiong/DATA$ sudo pg_createcluster -u yuqiong -d /media/yuqiong/DATA/postgresdb --start 11 3dcitydb

Creating new PostgreSQL cluster 11/3dcitydb ...
/usr/lib/postgresql/11/bin/initdb -D /media/yuqiong/DATA/postgresdb --auth-local peer --auth-host md5
The files belonging to this database system will be owned by user "yuqiong".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /media/yuqiong/DATA/postgresdb ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... 2018-12-28 12:02:56.494 EST [405] FATAL:  data directory "/media/yuqiong/DATA/postgresdb" has invalid permissions
2018-12-28 12:02:56.494 EST [405] DETAIL:  Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
child process exited with exit code 1
initdb: removing contents of data directory "/media/yuqiong/DATA/postgresdb"
Error: initdb failed

这是我对该文件夹的许可:

yuqiong@yuqiong-G7-7588:/media/yuqiong/DATA$ ll | grep postgresdb
drwxrwxrwx  1 yuqiong yuqiong      48 Dec 28 12:02 postgresdb/

我也尝试过sudo chmod 0700 -R /media/yuqiong/DATA/postgresdb,但这也不起作用。

一个警告是我的笔记本电脑具有Windows和Ubuntu双系统。这最初是Windows笔记本电脑,因此文件系统分区在此磁盘上为fuseblk。这会成为问题吗?

另一种可能是我在文档中读到root不能拥有群集,但是我不是root吗?同样,这似乎也不是错误消息所暗示的...

谢谢!

1 个答案:

答案 0 :(得分:0)

所以问题是我的/media/data目录是已安装的硬盘,格式为Windows File System,但不是Linux。因此,chmodchown将不起作用。我最终备份了所有内容并重新格式化了磁盘,从而解决了问题。

相关问题