1

I've been trying to set up a mongodb instance (2.6.11) on my CentOS 6.3 to use a data location on a different drive because of space constraints on the default location of /var/lib/mongo

I've changed the dbpath parameter in /etc/mongo.conf and created the appropriate location on the alternate drive, e.g. /mnt/newdrive/mongo. To make sure the service can access the new location, I've set the user and group to mongod with

chown -R mongod:mongod /mnt/newdrive/mongo

If I start the daemon using the commands

sudo service mongod start  

or

/etc/init.d/mongod start

the starting fails with

std::exception: boost:filesystem::status: Permission denied: "/mnt/newdrive/mongo", terminating

If I start with

sudo mongod --config /etc/mongo.conf

The process starts happily, though, to shut it down I need to issue

sudo mongod --config /etc/mongo.conf --shutdown

as the service/init.d scripts don't work.

The same issue is apparent when creating a symlink /mnt/newdrive/mongo -> /var/lib/mongo instead of changing the configuration (the 'permission denied' error, in that case, is on the symlink). The new drive is already accessible by different accounts for other purposes and it's mounted, fstab reporting

/dev/sb1/ /mnt/newdrive ext4 defaults 1 2

the ACL is as follows:

# file: mnt/newdrive/mongo
# owner: mongod
# group: mongod
# flags: -s-
user::rwx
group::rwx
other::rwx

Any idea what might be wrong?

Many thanks, Alberto

1
  • Allowing traversing of the intermediate folder with chmod -R o+x /mnt/newdrive seems to have done the trick. I suspect that's a bit of a compromise though. Or is it? Sep 8 '15 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.