# How To Move Existing & Store Future Local MongoDB Data From One Drive To Another (Hard) Drive - Windows 10

Hello Fellow Codenewbies 👋,

It all started with my computer's lack of space for C: drive. 
Finally, I moved all projects and personal folders to the D: drive to make more space in the C: drive.

And then, the time came when I wanted to continue one of my NodeJS with MongoDB projects.

When I run `mongod`, it throws me a `shutting down with code: 100` error as below.

![mongod shutting down with code 100](https://dev-to-uploads.s3.amazonaws.com/i/7dmnaxrb391x411q4229.jpg)

I faced chains of errors afterward.

I've Googled only to find plenty of results to fix the errors with either Linux or macOS and barely saw anything for Windows 10.

I had two choices:
1. Uninstall and re-install MongoDB with a new database path.
2. Go through a series of trials and errors to adapt the Linux or macOS steps for Windows 10.

As painful as it is, I've chosen the second way so I can help others who want to do the same.

Without further ado, below is how I did it.

***

## What I Want To Achieve
* Move existing MongoDB databases from C: to D: drive
* Store future databases in D: drive

## How I Achieved It

1. Make sure that `mongod` doesn't run in the background. You can close it with `ctrl + c` if it still runs.
1. Create a folder named `data` with subfolder `db` in D: drive (or any other location that you prefer)
2. Run this command in **Windows PowerShell (Admin)**
     
     ```bash
     mongod --dbpath="D:\data\db"
     ```
     Change the path to where you created your new data folder, and make sure you put the path *inside the quote*.
3. Exit `mongod` with `ctrl + c`
4. Copy/cut & paste existing data from the data folder in drive C: to D:
5. Make sure that the `mongod.lock` file is empty. Otherwise, you can delete it. This step won't damage anything and will be automatically regenerated when you run `mongod`. (When it's not empty, it will throw an error & `mongod` will automatically shut down.)
 
✔ Your existing data now should have been moved, and you can start to get your data stored in the new directory when you work with one.

---

Thank you for reading!
<br>
Last, you can find me on [Twitter](https://twitter.com/@AdiatiAyu). Let's connect! 😊
