I'm trying to use NFS as db path for my MongoDB (which I read is not recommended, but a client demands it that way) and I'm having trouble separating the journal files.

How would I do that? I've tried setting the dbpath to /mnt/nfs and it works, but the journal directory is there as well...

Any hints?

  • 1
    What's the exact error message? How do you determine that is doesn't work? Did you set the NFS options indicated in the mongodb documentation: bg, nolock, and noatime? Commented Jan 8, 2014 at 10:05
  • There is no error message. Problem is that journal directory is on NFS server as well, and it shouldn't be. I want to leave journal directory on the local machine, as per documentation.
    – ivica
    Commented Jan 8, 2014 at 10:08

2 Answers 2


You have to create a symbolic link that points to the new mountpoint:

If your server runs out of disk space for journal files, the server process will exit. By default, mongod creates journal files in a sub-directory of dbpath named journal. You may elect to put the journal files on another storage device using a filesystem mount or a symlink.


If you place the journal files on a separate storage device you will not be able to use a file system snapshot tool to capture a valid snapshot of your data files and journal files.

Updated link about: Journal files


If you have a directory on a different partition (instead of a separate partition), you can use a bind mount to get part of an existing mount in another place.

If your journal is located in /data/mongo_journal and the desired path is the default - /var/lib/mongodb/journal, you can add this to /etc/fstab:

/data/mongo_journal  /var/lib/mongodb/journal        none    defaults,bind 0 0

(It is important to ensure that this happens after the mount of /data (or the partition containing it).

(This is useful for cases where the application does not deal with symbolic links or for chroots)

For other Unix-like OSes, similar options exist, they tend to have somewhat different details though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.