Changing MongoDB data store directory
问题 Until now I have not been specifying a MongoDB data directory and have had only one 30 GB primary partition. I just ran out of space and added a new hard disk. How can I transfer my data (that is apparently in /var/lib/mongodb/ ) and configure MongoDB so that everything runs off of the new disk without affecting my existing installation? 回答1: The short answer is that the --dbpath parameter in MongoDB will allow you to control what directory MongoDB reads and writes it's data from. mongod -