PostgreSQL and database cluster ownership on shared storage

1

For my research, I am using an always on virtual machine for the primary analysis of my data. In doing this I need (or, I suppose, would like to) create and store the data in a PostgreSQL database. The VM is running CentOS 7, and my login (we'll call it 'username') has root access. The problem:

The data must be stored on mounted shared storage in the location /shared/username/data. I ('username') am the owner of the /shared/username/ directory and all subdirectories, and (for security reasons?) it seems like this cannot be changed via chown or sudo chown. This means I cannot initiate the database as the postgres user, as it needs ownership of the /shared/username/data. See below.

Logged in as postgres:

bash-4.2$ /usr/pgsql-9.4/bin/initdb -D /shared/username/data
could not change directory to "/shared/username": Permission denied
The files belonging to this database system will be owned by user "postgres".
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.

initdb: could not access directory "/shared/username/data": Permission denied

I am new to PostgreSQL, but have been using various forms of Linux for some time. Though file permissions sometimes confuse me.

Is there a possible solution to this problem? Perhaps somehow prevent initdb from revoking access permissions for username? Any help is appreciated, and I am happy to provide any additional info.

James

Posted 2015-07-19T17:34:31.817

Reputation: 11

No answers