Moving datafiles to a different windows machine

Hi,

I have taken the /data/db folder copy from a different windows laptop and pasted it in my laptop. I tried starting the mongod with dbpath pointing to the folder which has the copy. I’m able to start the server, but I don see the collections/databases. Please advice.

Thanks,
Durga

Hi Durga,

Please share the mongod command line you used on the second laptop.

Also, how exactly did you perform the copy? Could you check if the “pasted” folder contains exactly the same files as the source folder?

Best regards,
Kevin

Hi Kevin,

Thank you for the reply!

I pasted the data/db folder from source(it was from my peer’s laptop) into /data/db1 in my laptop. I checked for the files and it matched the source count. I used the below command.

mongod --port 27017 --dbpath /data/db1

Regards,
Durga

Hi Durga,

That should work ok, so I’m not sure what went wrong. Could you double check the dbpath, since typically path like /data/db1 (with slashes) are Unix-style paths. Windows usually have drive letters e.g. C:\data\db1

Another possibility is that there is a startup error or warning on the logs. Maybe the server is unable to open some file, permission issues, etc.? If you can post the full mongod log when it starts up, there might be some hint there.

Best regards,
Kevin

1 Like