0

I've got postgres 9.1 running on raspbian installed with apt-get. I've got NTFS usb HDD mounted in /mnt/usb. What I'd like to achieve is to create a tablespace pointing to /mnt/usb/postgres so I invoke:

CREATE TABLESPACE usbwd LOCATION '/mnt/usb/postgres';

and I get:

could not set permissions on directory "/mnt/usb/postgres": Operation not permitted

which is understandable since the manual states that the target directory has to be empty (it is in my case) and owned by postgres linux user. That's what I have problem with and

sudo chown postgres:postgres /mnt/usb/postgres

changes nothing, meaning the ownership does not change. The /mnt/usb/postgres is owned by pi user, and I need to have it owned by postgres user. The /mnt/usb is also owned by pi user. What am I missing ?

1
  • Ok I've got it. The ownership is for the whole mount point. I need to think of some other solution.
    – jankes
    Mar 22 '15 at 13:17
2

PostgreSQL won't run off NTFS on Linux. Format the drive as ext4.

Frankly, putting a database on a USB key on a tablespace isn't usually a great idea. The tablespace is unreadable without the rest of the database, and the rest of the database is useless without the tablespace. So you're creating a fragile system with two points of failure.

It's a much better idea to instead move the whole PostgreSQL data directory onto the USB drive.

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.