LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-27-2015, 09:14 AM   #1
darkpool
LQ Newbie
 
Registered: Apr 2015
Posts: 3

Rep: Reputation: Disabled
PostgreSQL - data folder on separate harddrive


hi all,

I am using Linux Mint 17.1 and have installed PostgreSQL 9.3 using:

sudo apt-get install postgresql postgresql-contrib

I have a separate hardrive mounted at /media/myusername/Storage
In the storage folder I have created a folder called postgres_data and have changed the ownership of the folder to postgres using:

sudo chown postgres:postgres /media/myusername/Storage/postgres_data

I am trying to set it up such that postgres will use this folder for the databases but am not having much luck. I have logged in as postgres and tried to run initdb but I get the following error:

su postgres
/usr/lib/postgresql/9.3/bin/initdb -D /media/myusername/Storage/postgres_data/

Quote:
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_ZA.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 "/media/myusername/Storage/postgres_data": Permission denied
Im not sure what to do because postgres is the owner of the folder and has full rights to it. Please could someone assist.

Last edited by darkpool; 04-27-2015 at 09:38 AM.
 
Old 04-27-2015, 09:35 AM   #2
darkpool
LQ Newbie
 
Registered: Apr 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
Just a quick follow up on my question. Could this issue have anything to do with the fact that postgres is the owner of:
/media/myusername/Storage/postgres_data

However it is not the owner of that whole path/hierarchy. It is only the owner of the actual folder.

Im just wondering out loud.
 
Old 04-27-2015, 11:54 AM   #3
darkpool
LQ Newbie
 
Registered: Apr 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
So I managed to get it working by giving read/write/execute permissions to everyone on that entire mounted harddrive, ie:

sudo chmod -R a+rwx /media/

This got the job done, but obviously I don't want to leave the permissions like this. Does anyone have any suggestions on how I can reduce the permissions so that I can just give ownership to postgres for the folder /media/myusername/Storage/postgres_data/

It seems like for some reason the postgres user needed full permissions to the entire hierarchy to do the initdb, not just the folder. But I can't just leave it like that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Spam tagged delivery in separate folder in qmail. studyete Linux - Server 1 03-02-2014 12:58 AM
How do I configure glibc in a separate build folder ? sleekmason Linux - Newbie 9 06-26-2012 06:38 PM
Unzip multiple zip files, each to separate folder smart_sagittari Linux - Newbie 3 03-21-2012 08:41 AM
help: slax in separate folder? VINSTAR Linux - Newbie 1 08-01-2009 03:50 AM
The postgresql data directory content in the pgsql directory is lost (empty data dir) kisembo Linux - Software 1 02-13-2006 01:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration