# Changing data directory of single-node install (Centos)

**URL:** <https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522>\
**Category:** CrateDB\
**Created:** [October 2, 2020, 2:31pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522 "2020-10-02T14:31:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karan\_Dhodi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/karan_dhodi/32/212_2.png) [@Karan\_Dhodi](https://community.cratedb.com/u/Karan_Dhodi)\
**Post date:** [October 2, 2020, 2:31pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522/1 "2020-10-02T14:31:51Z")

</div>

I installed CrateDB 4.2.4 using “**bash -c "$(curl -L [https://try.crate.io/](https://try.crate.io/))**”" on my centos machine.

It’s installed in my /home directory. However my /home directory has less space and I want to change the data directory to /opt/crate\_data. How do I achieve this?

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [October 2, 2020, 2:34pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522/2 "2020-10-02T14:34:52Z")

</div>

Change the configuration file (crate.yml) and include

```auto
# Storage: CrateDB can utilize multiple volumes in parallel, make sure to set
# the owner to 'crate:crate'
path.data: /opt/crate_data

```

---

<div class="post-metadata">

**Author:** ![Karan\_Dhodi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/karan_dhodi/32/212_2.png) [@Karan\_Dhodi](https://community.cratedb.com/u/Karan_Dhodi)\
**Post date:** [October 2, 2020, 2:37pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522/3 "2020-10-02T14:37:16Z")

</div>

I already have a few tables in /home directory. Would changing path.data affect them?

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [October 2, 2020, 2:39pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522/4 "2020-10-02T14:39:26Z")

</div>

yes, but copying the folder/files from the `data` folder in your home directory over to `/opt/crate_data` should work.

you should make those changes, while the cluster is stopped.

---

<div class="post-metadata">

**Author:** ![Karan\_Dhodi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/karan_dhodi/32/212_2.png) [@Karan\_Dhodi](https://community.cratedb.com/u/Karan_Dhodi)\
**Post date:** [October 2, 2020, 2:41pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522/5 "2020-10-02T14:41:25Z")

</div>

Okay thank you ! I am kind of new to this so just wanted to know what this means “ **make sure to set**  
**the owner to 'crate:crate** ’” in crate.yml?

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [October 2, 2020, 2:45pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522/6 "2020-10-02T14:45:40Z")

</div>

you have to make sure, that crate has the appropriate permissions (read/write) the folder.  
depending on which user you start crate with, you have to adapt that.

With the quick-start script I think crate typically should start with your logged in user and therefore that user should have sufficient rights.

---

<div class="post-metadata">

**Author:** ![Yugannddhar](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/yugannddhar/32/413_2.png) [@Yugannddhar](https://community.cratedb.com/u/Yugannddhar)\
**Post date:** [August 12, 2021, 2:35pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522/7 "2021-08-12T14:35:06Z")

</div>

Hi,

I came across the same situation now. New to crate.  
Can you please let me if the following are steps that need to be followed.

1. Stop crate
2. add new path in the crate.yml file
3. copy crate folder from old path to new path
4. start crate

I just want to make sure that I don’t lose any data

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [August 12, 2021, 2:41pm UTC](https://community.cratedb.com/t/changing-data-directory-of-single-node-install-centos/522/8 "2021-08-12T14:41:05Z")

</div>

yes, this should work.  
Be aware that the user that you start crate with has the appropriate permissions on that folder.

* * *

Best practice would definitely also be to create a (backup) snapshot first: [Snapshots — CrateDB: Reference](https://crate.io/docs/crate/reference/en/4.6/admin/snapshots.html)
