I get the following error when I try to create the MongoDB data/db directory:
sudo mkdir -p /data/db
mkdir: /data/db: Read-only file system
MongoDB requires a data folder to store its files. The default location for the MongoDB data directory is c:\data\db.
Copy the data folder of your mongodb to the new location - cp -R /var/lib/mongodb/ /mnt/database/ Remove the old database folder - rm -rf /var/lib/mongodb/ Create symbolic link to the new database folder - ln -s /mnt/database/mongodb /var/lib/mongodb. Start mongod - /etc/rc.
The remount didn't work for me (it requires Disabling SIP, which I didn't want to do) So instead I moved the mongo folder. You should have the old folder under the 'Relocated items' folder on your desktop so just copy it wherever you want (I moved it to my user folder) and then in the terminal go
mongod --dbpath /users/<username>/data/db/
hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With