# How to move Data and Logs to new directory?

**URL:** <https://discuss.elastic.co/t/how-to-move-data-and-logs-to-new-directory/28382>\
**Category:** Elasticsearch\
**Created:** [August 31, 2015, 7:40pm UTC](https://discuss.elastic.co/t/how-to-move-data-and-logs-to-new-directory/28382 "2015-08-31T19:40:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkraut](https://avatars.discourse-cdn.com/v4/letter/d/7c8e57/32.png) [@dkraut](https://discuss.elastic.co/u/dkraut)\
**Post date:** [August 31, 2015, 7:40pm UTC](https://discuss.elastic.co/t/how-to-move-data-and-logs-to-new-directory/28382/1 "2015-08-31T19:40:50Z")

</div>

I installed ElasticSearch using defaults. Now my /var directory is full. I'd like to move ES to a different partition on the server without losing data. Can this be done and if so, how?

More specifically, I'd like to move data and logs to /spare \>

Filesystem Size Used Avail Use% Mounted on  
/dev/sda6 969M 341M 562M 38% /  
devtmpfs 16G 0 16G 0% /dev  
tmpfs 16G 0 16G 0% /dev/shm  
tmpfs 16G 1.6G 15G 10% /run  
tmpfs 16G 0 16G 0% /sys/fs/cgroup  
/dev/sda1 12G 1.7G 9.2G 16% /usr  
/dev/sdb1 1.7T 77M 1.6T 1% /spare  
/dev/sda3 1.9G 82M 1.7G 5% /home  
/dev/sda2 8.6G 8.4G 0 100% /var  
/dev/sda7 250G 61M 237G 1% /data

-Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 31, 2015, 9:12pm UTC](https://discuss.elastic.co/t/how-to-move-data-and-logs-to-new-directory/28382/2 "2015-08-31T21:12:27Z")

</div>

You can set that in `elasticsearch.yml` using these - [https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-dir-layout.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-dir-layout.html)

---

<div class="post-metadata">

**Author:** ![dkraut](https://avatars.discourse-cdn.com/v4/letter/d/7c8e57/32.png) [@dkraut](https://discuss.elastic.co/u/dkraut)\
**Post date:** [September 1, 2015, 6:33am UTC](https://discuss.elastic.co/t/how-to-move-data-and-logs-to-new-directory/28382/3 "2015-09-01T06:33:31Z")

</div>

Thanks Mark, but I was looking for more detailed steps. Here's what I ended up doing in case anyone else is looking for this information the future. \>

• Determine current location of data files \> curl "localhost:9200/\_nodes/settings?pretty=true"

• Create new directory structure - e.g; \> cd /spare \> mkdir data

• Stop ntopng service \> systemctl stop ntopng.service

• Stop ES service \> systemctl stop elasticsearch.service

• Navigate to the current Data Directory determined in step 1 and copy files to new location \> cp -RP \* /spare/data/

• Change ownership on new directory to elasticsearch \> chown -R elasticsearch:elasticsearch /spare/data

• Edit data path \> vi /etc/elasticsearch/elasticsearch.yml  
\*Edit data parameter “path.data:” to “path.data:/spare/data

• Start ES \> systemctl start elasticsearch.service

• Start ntopng \> ntopng -F "es;flows;ntopng-%Y.%m.%d;[http://127.0.0.1:9200/\_bulk;](http://127.0.0.1:9200/_bulk;)" -e -i 1  
\*careful on this command as your input interface may not be -e -i 1 and your IP may be different.

Worked!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:52pm UTC](https://discuss.elastic.co/t/how-to-move-data-and-logs-to-new-directory/28382/4 "2017-07-05T23:52:59Z")

</div>


