1

I have a problem when I want to initialize a folder as a data folder:

postgres@ccruzado-test01:~$ /usr/lib/postgresql/9.3/bin/initdb -D /datadrive/postgresql/
The files belonging to this database system will be owned by user "postgres".
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.

creating directory /datadrive/postgresql ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /datadrive/postgresql/base/1 ... LOG:  could not link file "pg_xlog/xlogtemp.1716" to "pg_xlog/000000010000000000000001" (initialization of log file): Operation not supported
FATAL:  could not open file "pg_xlog/000000010000000000000001": No such file or directory
child process exited with exit code 1
initdb: removing data directory "/datadrive/postgresql"

The directory /datadrive/postgresql/ is a drive mounted by CIFS in FSTAB

//prueba /datadrive cifs vers=2.1,credentials=/home/user/.smbcredentials,dir_mode=0777,file_mode=0777,nounix 0 0. 

The OS is Ubuntu 14.04

  • What OS are you on? What are the mount options for your CIFS share? – Kassandry Aug 28 '15 at 17:45
  • Ububtu 14.04, I mount the drive with this command in FSTAB: //prueba /datadrive cifs vers=2.1,credentials=/home/user/.smbcredentials,dir_mode=0777,file_mode=0777,nounix 0 0. I edit the question. Thanks. – Carlos Cruzado Aug 28 '15 at 17:48
1

Creating the data directory on Linux includes creating hard links, which is not supported on CIFS shares. This is why the creation is failing.

It's usually not a good idea to create data stores / clusters on remote shares, it might lead to issues if the share disappears in the middle of using it.

|improve this answer|||||
  • ok, so it's not possible :(, do you have documentation about this? – Carlos Cruzado Aug 28 '15 at 19:49
0

You can follow these steps:

  1. Check the uid and gid of the postgres user

    bash-4.2$ id postgres
    
    uid=1001(postgres) gid=1001(postgres) groups=1001(postgres)
    
  2. dir_mode and file_mode should be 0700 while mounting.

    Give the uid and gid parameter while mounting, e.g.:

    bash-4.2$ mount.cifs -o username=NASUser,password=NAS_PASSWORD,dir_mode=0700,file_mode=0700,gid=1001,uid=1001 //IP/PATH  MountPath
    
|improve this answer|||||

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.