Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I recently purchased a new hard drive, for the sole purpose of storing a database. I am running Ubuntu 10.0.4.

Since I had not done this sort of thing before, I decided to use the GUI (Disk Utility) to format and mount the disk (to avoid any snarfus caused by typos etc at the command line).

I correctly identified the new drive and proceeded as follows:

  1. Elected to format the drive
  2. Selected type: 'Ext4'
  3. Selected the 'Take ownership of filesystem' checkbox
  4. Unchecked the 'encrypt underlying device' checkbox
  5. Provided a name for the new volume (mydata)

Once the device had been formatted, I then mounted the device as follows:

sudo mount /dev/sdb /mydata

I created the directory /mydata/pgdbdata

and changed ownership as follows

sudo chown -R postgres:postgres /mydata/pgdbdata

I check:

username@localhost:~$ ls -l /mydata/
total 20
drwx------ 2 root     root     16384 2012-06-19 23:05 lost+found
drwxr-xr-x 2 postgres postgres  4096 2012-06-20 19:04 pgdbdata

However when I change to postgres user:

username@localhost:~$ sudo su - postgres
postgres@localhost:~$ ls -l /mydata/
ls: cannot open directory /mydata/: Permission denied

Because of this permissions issue, I can start the postgresql service and I can't create the postgresql db cluster. I am stuck.

What am I doing wrong?

share|improve this question
    
From your question I suppose that /media/market_data/ is owned by user and group root. pgdbdata folder has been only chowned to user and group postgres. But you are checking a wrong folder? –  pl1nk Jun 20 '12 at 23:34
    
@pl1nk: Sorry. That was a typo. I have corrected the text in my question. –  Homunculus Reticulli Jun 21 '12 at 8:06
    
You should change the permissions of /mydata/ –  pl1nk Jun 21 '12 at 8:34
add comment

1 Answer 1

up vote 0 down vote accepted

You have only changed permission of pgdbdata but not of mydata you should be able to do a ls -l /mydata/pgdbdata but if your postgresql user wants to see the content of mydata it has to have read access to that too.

share|improve this answer
1  
Thanks. I don't know why or how I missed that ... Nothing like a second pair of eyes ... :) –  Homunculus Reticulli Jun 21 '12 at 11:40
    
You're welcome. Sometimes you're just blind. Happens to me all the time ;-) –  André Stannek Jun 21 '12 at 16:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.