Permission denied when moving data folder

48 views
Skip to first unread message

Alberto Giannetto

unread,
Sep 7, 2015, 4:50:08 PM9/7/15
to mongodb-user
Hi there,

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 location, e.g. /mnt/newdrive/mongo
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  
/etc/init.d/mongod start

the starting fails with permission denied when accessing the new data location.

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 properly mounted.

It seems that it might be a problem with the init.d script rather than the configuration.
Any idea what might be afoot?

Many thanks,
Alberto


Alberto Giannetto

unread,
Sep 8, 2015, 7:20:36 AM9/8/15
to mongodb-user
Or, could it be something to do with how the drive is mounted in fstab? it's using the 'defaults' mask.
Reply all
Reply to author
Forward
0 new messages