1

I'm trying to get mongoDB run under Arch.
However, I'm only able to start it as root or using systemctl with the default path.

What I'm trying to do is to change the default data path from

/data/db

to

/home/manuel/ExtDrive/Data/mongodb

and run it using systemctl.

As ExtDrive indicates, this is an ext4 formatted drive connected via SATA (not USB).

As soon as I change the path in my mongoconfig, the service starts failing:

mongodb.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/usr/lib/systemd/system/mongodb.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2019-01-11 19:45:56 CET; 1s ago
  Process: 29468 ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf (code=exited, status=100)
 Main PID: 29468 (code=exited, status=100)

Jan 11 19:45:56 Rechner mongod[29468]: 2019-01-11T19:45:56.311+0100 I CONTROL  [initandlisten]     distarch: x86_64
Jan 11 19:45:56 Rechner mongod[29468]: 2019-01-11T19:45:56.311+0100 I CONTROL  [initandlisten]     target_arch: x86_64
Jan 11 19:45:56 Rechner mongod[29468]: 2019-01-11T19:45:56.311+0100 I CONTROL  [initandlisten] options: { config: "/etc/mongodb.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/home/manuel/ExtDrive/Data/mongodb/", jo>
Jan 11 19:45:56 Rechner mongod[29468]: 2019-01-11T19:45:56.312+0100 I STORAGE  [initandlisten] exception in initAndListen: Location28596: Unable to determine status of lock file in the data directory /home/manuel/ExtDrive/Data/mongodb/: b>
Jan 11 19:45:56 Rechner mongod[29468]: 2019-01-11T19:45:56.312+0100 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
Jan 11 19:45:56 Rechner mongod[29468]: 2019-01-11T19:45:56.312+0100 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
Jan 11 19:45:56 Rechner mongod[29468]: 2019-01-11T19:45:56.312+0100 I CONTROL  [initandlisten] now exiting
Jan 11 19:45:56 Rechner mongod[29468]: 2019-01-11T19:45:56.312+0100 I CONTROL  [initandlisten] shutting down with code:100
Jan 11 19:45:56 Rechner systemd[1]: mongodb.service: Main process exited, code=exited, status=100/n/a
Jan 11 19:45:56 Rechner systemd[1]: mongodb.service: Failed with result 'exit-code'.

Permissions for the directory are:

drwxr-xr-x 4 mongodb daemon 4.0K Jan 11 19:37 mongodb

Here is my mongo config:

storage:

  dbPath: "/home/manuel/ExtDrive/Data/mongodb/"

  journal:

    enabled: true

net:

  port: 27017

  bindIp: 127.0.0.1

Why does it run perfectly with the standard path, but stops working as soon as I specify an alternative path?
If I'm missing important information, please let me know.

New contributor
CvG is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    Firstly, the user directories inside of /home are not traversable by other users by default. Second, selinux can also be an issue. Last, is there a reason that you need the data to be in your home directory? You're increasing the risk of accidental deletion. – Nasir Riley Jan 11 at 21:01
  • I am used to mount all my harddrives in /home since I have different harddrives for data, source code etc. Mounting the harddrive under /mnt and symlinking the folders back to /home did the trick for me, however I'd still rather mount the drive in /home – CvG Jan 12 at 13:54
  • What does it matter that they're different? Just create different directories in /mnt and put them there like you've already done. – Nasir Riley Jan 12 at 14:38

Your Answer

CvG is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.