Permission issues with mounted new hard drive on Ubuntu machine
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.
Related videos on Youtube
Homunculus Reticulli
Updated on September 18, 2022Comments
-
Homunculus Reticulli over 1 year
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:
- Elected to format the drive
- Selected type: 'Ext4'
- Selected the 'Take ownership of filesystem' checkbox
- Unchecked the 'encrypt underlying device' checkbox
- 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?
-
pl1nk almost 12 yearsFrom 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? -
Homunculus Reticulli almost 12 years@pl1nk: Sorry. That was a typo. I have corrected the text in my question.
-
pl1nk almost 12 yearsYou should change the permissions of /mydata/
-
Homunculus Reticulli almost 12 yearsThanks. I don't know why or how I missed that ... Nothing like a second pair of eyes ... :)
-
André Stannek almost 12 yearsYou're welcome. Sometimes you're just blind. Happens to me all the time ;-)