# Elasticsearch creates empty directories in /tmp, can I delete these empty directories

**URL:** <https://discuss.elastic.co/t/elasticsearch-creates-empty-directories-in-tmp-can-i-delete-these-empty-directories/325887>\
**Category:** Elasticsearch\
**Created:** [February 18, 2023, 12:34pm UTC](https://discuss.elastic.co/t/elasticsearch-creates-empty-directories-in-tmp-can-i-delete-these-empty-directories/325887 "2023-02-18T12:34:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eranga\_bandara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eranga_bandara/32/117421_2.png) [@eranga\_bandara](https://discuss.elastic.co/u/eranga_bandara)\
**Post date:** [February 18, 2023, 12:34pm UTC](https://discuss.elastic.co/t/elasticsearch-creates-empty-directories-in-tmp-can-i-delete-these-empty-directories/325887/1 "2023-02-18T12:34:28Z")

</div>

Elasticsearch creates directories inside `/tmp`. These directories used to execute native code by `jna` and `libffi`. Most of the time these directories are empty and have the name like `elasticsearch.KNoHBn19`. more info [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/executable-jna-tmpdir.html).

When running Elasticsearch for years it filled up `/root` directory due to the directories created by Elasticsearch in the `/tmp`. To override this, I can point Elasticsearch tmp directory to another disk via setting `ES_TMPDIR`. But still have thousands of empty directories.

Is it safe to remove these old empty directories created by Elasticsearch? Or Elasticsearch will use all the empty directories created in tmp.

---

<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:** [February 20, 2023, 2:08am UTC](https://discuss.elastic.co/t/elasticsearch-creates-empty-directories-in-tmp-can-i-delete-these-empty-directories/325887/2 "2023-02-20T02:08:54Z")

</div>

Welcome to our community! 😃

> [@eranga\_bandara](#):
>
> When running Elasticsearch for years it filled up `/root` directory due to the directories created by Elasticsearch in the `/tmp`

`/tmp` is not `/root` though? Do you mean `/`?

> [@eranga\_bandara](#):
>
> Is it safe to remove these old empty directories created by Elasticsearch? Or Elasticsearch will use all the empty directories created in tmp.

They should be cleaned up on a system restart. Are they causing an issue?

---

<div class="post-metadata">

**Author:** ![eranga\_bandara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eranga_bandara/32/117421_2.png) [@eranga\_bandara](https://discuss.elastic.co/u/eranga_bandara)\
**Post date:** [February 20, 2023, 8:59am UTC](https://discuss.elastic.co/t/elasticsearch-creates-empty-directories-in-tmp-can-i-delete-these-empty-directories/325887/3 "2023-02-20T08:59:47Z")

</div>

sorry about the typo it's not `/root` its just `root` or `/`, 🙂

instead of waiting restart, is that ok to manually clean the empty `elasticsearch.XXXXX` directories on `/tmp`. otherwise these directories are filling up the storage.

---

<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:** [March 20, 2023, 8:59am UTC](https://discuss.elastic.co/t/elasticsearch-creates-empty-directories-in-tmp-can-i-delete-these-empty-directories/325887/4 "2023-03-20T08:59:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
