0

I cant create a new tablespace in mounted directory

psql -U sysuser -d postgres -c "CREATE TABLESPACE dadospostgres LOCATION '/media/tiago/Dados/Postgres/Bancos';"
ERROR:  could not set permissions on directory "/media/tiago/Dados/Postgres/Bancos": Permission denied

psql -U sysuser -d postgres -c "CREATE TABLESPACE dadospostgres LOCATION '/media/tiago/Dados/Postgres';"
ERROR:  could not set permissions on directory "/media/tiago/Dados/Postgres": Permission denied

Folders permissions:

root@tiago:/media/tiago/Dados# ls -l /media/
total 4
drwxr-x---+ 4 root root 4096 out 14 11:29 tiago

root@tiago:/media/tiago/Dados# ls -l /media/tiago/ | grep Dados
drwxrwxrwx 1 tiago tiago 8192 out 14 10:52 Dados

root@tiago:/media/tiago/Dados# ls -l /media/tiago/Dados/ | grep Postgres
drwx------ 1 postgres postgres         144 out 14 11:33 Postgres

root@tiago:/media/tiago/Dados# ls -l /media/tiago/Dados/Postgres/
total 0
drwx------ 1 postgres postgres 0 out 14 11:33 Bancos

Mounted disk

root@tiago:/media/tiago/Dados# lsblk -O
└─nvme1n1p2
     nvme1n1p2
           /dev/nvme1n1p2
                259:9    188,9G 953,9G ntfs     765G    80% /media/tia Dados 56836A8F5F3C7018                     3af9eb40-7c61-4a6f-a748-180335979b27 dos    ebd0a0a2-b9e5-4433-87c0-68b6b72699c7           01418683-fa44-448e-92c1-234d67229098           128  0  0       0              953,9G       root  disk  brw-rw----         0    512      0     512     512    0 none      255 part        0      512B       2T         0    0B uuid.df8e86d6-8a47-9916-2e43-8e8b6efdb7cd    0 nvme1n1

root@tiago:/media/tiago/Dados# cat /etc/fstab
UUID=56836A8F5F3C7018  /media/tiago/Dados       ntfs-3g auto,users,permissions 0 0

I need the free space in this mounted disk.

2

User postgres has no "execute" permissions on the /media directory. Hence the error.

1
  • sudo chmod +x /media and sudo chmod +x /media/tiago fixed the problem, tankyou Oct 15 '21 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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