LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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



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
How do I configure glibc in a separate build folder ? sleekmason Linux - Newbie 11 12-22-2021 08:27 AM
Spam tagged delivery in separate folder in qmail. studyete Linux - Server 1 03-02-2014 12:58 AM
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 03:40 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
Open Source Consulting | Domain Registration