Moving MongoDB's data folder?
When you start mongod
process you provide an argument to it --dbpath /directory
which is how it knows where the data folder is.
All you need to do is:
- stop the
mongod
process on the old computer. wait till it exits. - copy the entire /data/db directory to the new computer
- start
mongod
process on the new computer giving it--dbpath /newdirectory
argument.
The mongod
on the new machine will use the folder you indicate with --dbpath. There is no need to "recognize" as there is nothing machine specific in that folder, it's just data.