MongoDB refuse to start, operation not permitted When I try to run mongod --dbpath=./data I get the following error:

2017-09-20T21:47:55.720+0200 I CONTROL  [initandlisten] MongoDB starting : pid=20500 port=27017 dbpath=./data 64-bit host=debian
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] db version v3.2.11
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] git version: 009580ad490190ba33d1c6253ebd8d91808923e4
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] allocator: tcmalloc
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] modules: none
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] build environment:
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten]     distarch: x86_64
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten]     target_arch: x86_64
2017-09-20T21:47:55.722+0200 I CONTROL  [initandlisten] options: { storage: { dbPath: "./data" } }
2017-09-20T21:47:55.781+0200 I -        [initandlisten] Detected data files in ./data created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-09-20T21:47:55.802+0200 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-09-20T21:47:55.894+0200 E STORAGE  [initandlisten] WiredTiger (1) [1505936875:894516][20500:0x7f357e7c1cc0], file:WiredTiger.wt, connection: ./data/WiredTiger.wt: handle-open: open: Operation not permitted
2017-09-20T21:47:55.895+0200 I -        [initandlisten] Assertion: 28595:1: Operation not permitted
2017-09-20T21:47:55.895+0200 I STORAGE  [initandlisten] exception in initAndListen: 28595 1: Operation not permitted, terminating
2017-09-20T21:47:55.895+0200 I CONTROL  [initandlisten] dbexit:  rc: 100


The contents and permissions of the ./data directory is as follows:

drwxrwx--- 1 root vboxsf  4096 Sep 20 05:11 .
drwxrwx--- 1 root vboxsf  4096 Sep 20 22:07 ..
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:25 collection-0--661121965341019305.wt
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:26 collection-0--9187569579836644431.wt
-rwxrwx--- 1 root vboxsf 16384 Sep 19 05:24 collection-2--661121965341019305.wt
drwxrwx--- 1 root vboxsf     0 Sep 19 19:16 diagnostic.data
-rwxrwx--- 1 root vboxsf 16384 Sep 19 05:24 index-0-7518289071480072689.wt
-rwxrwx--- 1 root vboxsf 16384 Mar  1  2017 index-1-7518289071480072689.wt
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:26 index-2-7518289071480072689.wt
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:25 index-3-7518289071480072689.wt
drwxrwx--- 1 root vboxsf     0 Sep 20 05:12 journal
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:24 _mdb_catalog.wt
-rwxrwx--- 1 root vboxsf     0 Sep 20 05:11 mongod.lock
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:26 sizeStorer.wt
-rwxrwx--- 1 root vboxsf    95 Feb 23  2017 storage.bson
-rwxrwx--- 1 root vboxsf    49 Feb 23  2017 WiredTiger
-rwxrwx--- 1 root vboxsf  4096 Sep 19 05:24 WiredTigerLAS.wt
-rwxrwx--- 1 root vboxsf    21 Sep 20 04:49 WiredTiger.lock
-rwxrwx--- 1 root vboxsf  1000 Sep 19 05:27 WiredTiger.turtle
-rwxrwx--- 1 root vboxsf 61440 Sep 20 05:12 WiredTiger.wt


My user is in the vboxsf group.

Does anyone know why I'm getting this error, or what I can do to fix this?



I should note that I'm running Debian inside Virtual Box on a Windows 8.1 host. The directory in question is a shared folder (hence the vboxsf group).
A summary of possible solutions are listed below for your convenience:

MongoDB Operation Not Permitted


  MongoDB was working perfectly until one day it generated a lock file and stopped starting with the following error:


The corresponding accepted Answer was: 


  Assuming permissions are correct. It could be an selinux issue, try:

setenforce 0

  
  then try to start the server. If the server starts, you will have to use semanage to set the proper context to the mongo data folder


Windows mounting /data/db


  I'm trying to mount /data/db from my Windows dev PC but everytime I try, Mongo crashes as it seems to not have the right BUT :
  
  
  I have changed the security parameters in windows to allow everyone to do everything (full access)
  If I mount in a different directory, it works (the container launchs itself and I can write in my directory)
  


A possible explanation was: 


  Found a link: VirtualBox Shared Folders are not supported by mongodb.


Apparently one user found a workaround and documented it as: 


  It works using a volume which is created using docker volume create --name=myvolume
  The volume name is used instead of the local path. It's just a workaround.
  To be more precise the line I used in my case :

docker volume create --name=mongodata
docker run -d -p 27017:27017 -v mongodata:/data/db --name=mymongo mongodb:3.3



Mongodb with volume doesn't work (Operation not permitted)

The initial person writing the issue had already determined that it wouldn't work and was in search of a solution.


  Mongo docs says For example, HGFS and Virtual Box’s shared folders do not support this operation.
  https://docs.mongodb.com/manual/administration/production-notes/#fsync-on-directories
  
  I wonder if it is possible to make work on current docker for windows.


There was a link in this case that recommeded tuning the mongodb storage engine:


  
    Doesn't docker plan to implemnt something like this?  
  
  
  No, not right now. You might be able to tweak the mongodb storage engine to work on an SMB share: https://forums.docker.com/t/issues-with-mongo-with-mounted-volume-for-data/15085/4


Summary

There are multiple issues surrounding MongoDB and virtual servers on Microsoft Windows, so you might want to consider running your MongoDB in a *nix environment.