1

I'm using Ubuntu 14.04. I'm trying to move my mongodb database files to another partition, which is mounted at boot at /media/my_username/files.

I'm trying to use the solution mentioned in this answer.

I followed the instructions here, and successfully mounted the partition at boot time with:

udisksctl mount --block-device /dev/disk/by-uuid/the_partiotion_uuid

However, the user that I used to run mongod, which is mongodb, have no access to the partition. When I run:

sudo -u mongodb -s cd /media/my_username/files

The result shows that user mongodb has no permission to access the directory. And through some searching and trying, it seems that chown is not functional in a mounted partition, the permission is set when the partition is mounted.

How do I solve this?

THX

Community
  • 1
  • 1
Eddie Huang
  • 135
  • 3
  • 9

2 Answers2

0

You need to mount the partition as mongodb user in order to access the files.

Try this. It shows how to mount a partition as a user other than root.

Community
  • 1
  • 1
Rajesh N
  • 2,554
  • 1
  • 13
  • 17
0

I tried another way around. Instead of start mongod as a service at boot time, I wrote a script to run it manually:

sudo nohup mongod --dbpath /media/me/partition_name/mongodb &

Since I mount /media/me/partition_name/ at boot, there's no problem.

Eddie Huang
  • 135
  • 3
  • 9