Could not set permission for new database on postgresql?

cn flag

I'm the beginner in PostgreSQL, today I cannot create new TABLESPACE on my HDD disk. Specifically:

  • I'm running the Ubuntu 20.04 on the SSD. Install and using Postgres 13 normally on this disk.
  • I want to create new DATABASE on the other HDD disk, due to the data size will be very huge.
  • I have run sudo chown postgres:postgres /destination/folder/on/HDD as well as sudo chown 700 /destination/folder/on/HDD before using postgres to create tablespace.
  • Access to postgres terminal by sudo -u postgres psql then run create tablespace table_name location '/destination/folder/on/HDD';
  • It raise the error ERROR: could not set permissions on directory "/destination/folder/on/HDD": Permission denied

So how to solve this problem? How can I create new database on HDD disk? Thanks for your help!

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.