Hello,
I want to customise (change) the dbPath on ubuntu 20.04.
The configuration file:
/etc/mongod.conf
specifies the data directory/dbPath:
/var/lib/mongodb
The docs here: https://docs.mongodb.com/manual/reference/configuration-options/#storage.dbPath
note that on linux one can’t simply change the dbPath in the config file:
" The Linux package init scripts do not expect storage.dbPath
to change from the defaults. If you use the Linux packages and change storage.dbPath
, you will have to use your own init scripts and disable the built-in scripts."
Unfortunately, I haven’t found any information on those init script(s), i.e. where I can find them, and what in them might need editing in order for the change of dbPath in the config. file to be allowed to work.
Because I’m using ubuntu the init system is systemctl, see here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Aside: why do I want to change the dbPath from its default? Because my laptop is dual boot and I have mongodb on both win10 and unbuntu, but want to be able to access the same database files–i.e. access the win10 directory/data storage from within the mongodb on ubuntu. So I think I want to use something like:
/media/[username]/[win10 partition name]/data/db
which corresponds to:
C:\data\db
But as the docs say, the init script(s) also need changing for that to work.
Thanks for your help.