1

I installed a postgresql database on Redhat 7.1 and I decided to move the database on an 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 the result is the same :

failure in starting postgresql

systemd: Starting Remote File Systems (Pre)
systemd: Reached Remote File Systems (Pre)
systemd: mounting /var/lib/pgsql
systemd:  starting PostgreSQL database server
kernel sdb: unknown partition table
postgresql-check-db-dir: "/var/lib/pgsql/data" is missing or empty
kernel: xfs (dm-4): Mounting V4 Filesystem
postgresql.service: control process exited, code=exited status=1
Failed to start PostgreSQL database server.
Unit postgresql.service entered failed state
sd 2:0:0:0: [sdb] attached SCSI disk
starting LVM2 PV scan on device 8:16
kernel: xfs (dm-3): Ending clean mount
systemd: Mounted /var/lib/pgsql
Starting Remote File Systems
Reached target Remote File Systems

Any ideas?

  • First update your system. If that doesn't solve the problem, open a case with Red Hat. – Michael Hampton Feb 18 '16 at 16:04
1

Hej all,

I have solved it on my server (RHEL 7.2) by editing '/usr/lib/systemd/system/postgresql-9.5.service' and adding 'After=remote-fs.target'

Hope this helps.

Best, Tim.

1

To make sure PostgreSQL starts after iSCSI volume are mounted, do the following:

cat >/etc/systemd/system/postgresql.service <<EOF
.include /lib/systemd/system/postgresql.service
[Unit]
After=remote-fs.target
EOF

This works with an arbitrary service (MongoDB, MySQL...) and any kind of remote access (NFS, Samba...).

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.