0

I installed Ubuntu 16.04 on a Windows laptop, and as a result I have a hard disk with Windows File Format. Now I need to create a PostgreSQL cluster on that disk, because it is larger. However, I got a permission error:

yuqiong@yuqiong-G7-7588:/media/yuqiong/DATA$ sudo pg_createcluster -u yuqiong -d /media/yuqiong/DATA/postgresdb --start 11 3dcitydb

Creating new PostgreSQL cluster 11/3dcitydb ...
/usr/lib/postgresql/11/bin/initdb -D /media/yuqiong/DATA/postgresdb --auth-local peer --auth-host md5
The files belonging to this database system will be owned by user "yuqiong".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /media/yuqiong/DATA/postgresdb ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... 2018-12-28 12:02:56.494 EST [405] FATAL:  data directory "/media/yuqiong/DATA/postgresdb" has invalid permissions
2018-12-28 12:02:56.494 EST [405] DETAIL:  Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
child process exited with exit code 1
initdb: removing contents of data directory "/media/yuqiong/DATA/postgresdb"
Error: initdb failed

However the user yuqiong indeed has rwx right on this drive:

yuqiong@yuqiong-G7-7588:/media/yuqiong/DATA$ ll | grep postgresdb
drwxrwxrwx  1 yuqiong yuqiong      48 Dec 28 12:02 postgresdb/

Presumably, I suspect this is because this disk is not actually a Linux File System format so the result returned by ll is not actually accurate.

In this case, how can I resolve this issue and grant the user yuqiong or postgres proper privilege on this drive? They need to be owners of directories to be able to create database cluster in PostgresQL.

Thanks!

Zanna
  • 70,465
yuqli
  • 103
  • 3

2 Answers2

1

No.

Actually there IS a way to do this almost directly.

You could easily convert NTFS to ext2 / ext3 with anyconvertfs from anyfs-tools

Then you could convert it to ext4 using tune2fs.

-- Answer in "Convert filesystem NTFS -> EXT4?" by enzotib

0

Thanks for Carlos's answer above that points me to an old discussion. I did not try the solution so not sure if that will work. My concern was I didn't know how to properly backup the applications I installed. Eventually I zipped everything, upload to Google Cloud, reformat the file system using mkfs, and downloaded and unzipped everything. Then I was able to create a cluster in this disk...

yuqli
  • 103
  • 3