# How to change storage destination for database files in QuestDB?

**URL:** https://community.questdb.com/t/how-to-change-storage-destination-for-database-files-in-questdb/44
**Category:** Community
**Tags:** config, question
**Created:** [June 26, 2024, 6:21pm UTC](https://community.questdb.com/t/how-to-change-storage-destination-for-database-files-in-questdb/44 "2024-06-26T18:21:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex004/uploads/questdb/original/1X/b6b1b349e598d0550947e63d7923a9d7df0279eb.png) [@system](https://community.questdb.com/u/system)
#### Post date: [June 26, 2024, 6:21pm UTC](https://community.questdb.com/t/how-to-change-storage-destination-for-database-files-in-questdb/44/1 "2024-06-26T18:21:46Z")

</div>

I tried to change directory in config file. As I want to save all data on disk D as it has more free space.

What I did is that I change: # directory for storing db tables and metadata. this directory is inside the server root directory provided at startup

```auto
cairo.root=D:

```

But I got this error:

> could not open read-write [file=C:\WINDOWS\system32\qdbroot\D:\_tab\_index.d]

---

<div class="post-metadata">

### Author: ![nwoolmer](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/nwoolmer/32/24_2.png) [@nwoolmer](https://community.questdb.com/u/nwoolmer)
#### Post date: [June 26, 2024, 6:22pm UTC](https://community.questdb.com/t/how-to-change-storage-destination-for-database-files-in-questdb/44/2 "2024-06-26T18:22:03Z")

</div>

Documentation could be better, but `cairo.root` is not really the root directory for QuestDB. You should leave the default value of `db` for that configuration parameter on `server.conf` before you continue. I will provide more context at the end of this answer.

QuestDB uses a default directory by default when you run `start`, [depending on the OS](https://questdb.io/docs/quick-start/#binaries), which for windows is `C:\Windows\System32\qdbroot`. Unless you explicitly pass a different root folder on startup, that folder will be used. Since the `server.conf` file is only read _after_ the root folder has been determined, the configuration `cairo.root` wouldn’t have any effect for this.

So, if you want to change the root directory to the D:\ drive, you should start with something like: `questdb.exe start -d D:\qdbroot`

Make sure the folder `D:\qdbroot` exists and the questdb service was not already started. If the service was started, you can issue `questdb.exe stop`.

If you have registered questdb as a service it via `questdb.exe install`, it will always use the default folder, but this can be changed. You need first to deregister the service with `questdb.exe remove` and then install again passing the `-d` parameter, as in:

`questdb.exe install -d D:\qdbroot`.

Again, make sure the folder `D:\qdbroot` exists. This will cause questdb to start as a service on startup of your system.

Now, what is the `cairo.root` config for then?. Well, QuestDB has by default this root directory structure:

```auto
questdb
├── conf
├── db
├── log
├── public
└── snapshot (optional)

```

The `cairo.root` folder makes reference to the `db` folder inside the root folder, which is why you get an error when changing that key on the config file. That property is only checked when doing things like attaching or detaching partitions, and you are better off just leaving the default value.
