Using CentOS 7. Used yum install mongodb-org
If I change the dbPath in /etc/mongod.conf it is not working when I start the mongod with systemctl start mongod.service. However if I start like mongod --dbpath /new/folder it is working fine.
In the documentation (https://docs.mongodb.com/manual/reference/configuration-options/) it is given that
The Linux package init scripts do not expect storage.dbPath to change from the defaults. If you use the Linux packages and change storage.dbPath, you will have to use your own init scripts and disable the built-in scripts.
How to change the default init scripts?
I have gone through Changing MongoDB data store directory Moving MongoDB's data folder? how to set mongod --dbpath