MongoDB.live, free & fully virtual. Register Now MongoDB.live, free & fully virtual. Register Now

Error using NFSv3 mount point: Unable to determine status of lock file in the data directory

I am getting this error on the NFSv3 filesystem as well

sudo docker run -it -v /mnt/mongo:/data/db --name mongodb e6fa3383f923
2020-11-12T09:09:15.814+0000 I STORAGE [initandlisten] exception in initAndListen: Location28596: Unable to determine status of lock file in the data directory /data/db: boost::filesystem::status: Permission denied: “/data/db/mongod.lock”, terminating

[root@init78a-36 ~]# mount | grep /mnt/mongo
10.20.20.3:/mongo on /mnt/mongo type nfs (rw,noatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.20.20.3,mountvers=3,mountport=2049,mountproto=udp,local_lock=all,addr=10.20.20.3)

@chris
[root@init78a-36 ~]# ls -dZ /mnt/mongodb
drwxr-xr-x. mongod mongod system_u:object_r:nfs_t:s0 /mnt/mongodb

Changed the filesystem to be writeable by mongod but still, I get the below error

{“t”:{"$date":“2020-11-12T17:35:40.193+00:00”},“s”:“E”, “c”:“STORAGE”, “id”:20557, “ctx”:“initandlisten”,“msg”:“DBException in initAndListen, terminating”,“attr”:{“error”:“Location28596: Unable to determine status of lock file in the data directory /data/db: boost::filesystem::status: Permission denied: “/data/db/mongod.lock””}}

Hi @dawood_MUNNA,

There are two things to consider in your deployment:

  1. Configure SELinux
    Specifically Non-Default MongoDB Directory Path(s)
  2. Production Notes - Remote Filesystem

Please also take notice of this warning: https://docs.mongodb.com/manual/administration/production-checklist-operations/#filesystem

Avoid using NFS drives for your dbPath . Using NFS drives can result in degraded and unstable performance. See: Remote Filesystems for more information.

@chris would this be applicable for docker containers as well?
My deployment is MongoDB on - Docker - NFS storage.

[root@init78a-36 ~]# mount | grep /mnt/mong
10.20.20.3:/mong on /mnt/mong type nfs (rw,noatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.20.20.3,mountvers=3,mountport=2049,mountproto=udp,local_lock=all,addr=10.20.20.3)

sudo docker run -it -v /mnt/mong/:/data/db --name mongonew1 ba0c2ff8d362
{“t”:{"$date":“2020-11-13T12:05:24.738+00:00”},“s”:“E”, “c”:“STORAGE”, “id”:20557, “ctx”:“initandlisten”,“msg”:“DBException in initAndListen, terminating”,“attr”:{“error”:“Location28596: Unable to determine status of lock file in the data directory /data/db: boost::filesystem::status: Permission denied: “/data/db/mongod.lock””}}

Sure. It might be that the required security context is docker instead of mongodb. But all the rest of the remote filesystem and nfs verbiage apply.