0

I installed a postgresql database on Redhat 7.1 and I decided to move the database on a ISCSI device (LUN) inside a logical volume, mounted at starting of the machine (xfs formatted). The mounting point is /var/lib/pgsql

At the boot of the server, postgresql.service is in failed status.

In messages.log :

systemd: mounting /var/lib/pgsql
 starting PostgreSQL database server
 kernel sdv: unknown partition table
 sd 2:0:0:0: [sdb] attached SCSI disk
 xfs (dm-4): Mounting V4 Filesystem
 postgresql-check-db-dir: "/var/lib/pgsql/data" is missing or empty
 postgresql.service: control process exited, code=exited status=1
 Failed to start PostgreSQL database server.

When I'm logged on the server, if it try to start manually the database : systemctl start postgresql --> OK (and I don't lose any data, database is available)

I think it's a problem of order in the boot process : network service must be started, then iscsi, then lvm etc...

So I tried to force dependencies on the /usr/lib/systemd/system/postgresql.service adding "After=lvm-pgscan.service iscsi.service" etc... but it doesn't change anything.

Any ideas ?

1

Based on the comment string, it appears that editing /usr/lib/systemd/system/postgresql.service with After=local-fs.target fixed the situation. The hint for me was the message:

postgresql-check-db-dir: "/var/lib/pgsql/data" is missing or empty

which implied that postgres was attempting to start before /var was mounted. Adding the after restriction forces systemd to wait until the local filesystem(s) are mounted before starting postgres.

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.