# Elasticsearch data nodes - disk usage optimisation

**URL:** https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544
**Category:** Elasticsearch
**Created:** [February 15, 2023, 5:59am UTC](https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544 "2023-02-15T05:59:52Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![chethan\_m](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@chethan\_m](https://discuss.elastic.co/u/chethan_m)
#### Post date: [February 15, 2023, 5:59am UTC](https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544/1 "2023-02-15T05:59:52Z")

</div>

I have an elasticsearch deployed on kubenetes/aws platform. I'm observing that Disk Free Space is not equal in the data nodes.  
I have 4 data nodes out of which,

- Two data nodes have around 1 TB free disk space

- One data node has 800 gb free

- And last one has 500 GB free

Can you please guide me about 'how to analyse the cause of this issue' and 'how do I optimise the disk usage' ?

---

<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 15, 2023, 9:43pm UTC](https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544/2 "2023-02-15T21:43:14Z")

</div>

Welcome to our community! 😃

What is the output from the `_cat/allocation?v` endpoint?

---

<div class="post-metadata">

### Author: ![chethan\_m](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@chethan\_m](https://discuss.elastic.co/u/chethan_m)
#### Post date: [February 20, 2023, 2:53pm UTC](https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544/3 "2023-02-20T14:53:12Z")

</div>

> [@warkolm](#):
>
> \_cat/allocation?v

Sorry for the delayed response. Here is a snapshot of \_cat/allocation?v  
Some nodes have high disk usage than the others.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/4/942996920228f29e1e2eb2e3a3eb39a04c83e65b.png)

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [February 20, 2023, 4:12pm UTC](https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544/4 "2023-02-20T16:12:26Z")

</div>

> [@chethan\_m](#):
>
> 'how to analyse the cause of this issue'

The cause of this issue is how Elasticsearch works, it will balance the number of the shards according to the number of nodes, trying to keep the same amount of shards in every node.

The issue is that you may have different kinds of data that will create different sizes of shards and Elasticsearch does not take the size of the shards in consideration, so you may end-up with a couple of big shards on some nodes and small shards on others.

For many years Elastic recommended that you avoid having small indices on the cluster, but in the last couple of years Elastic itself does not follow this guideline as the integrations and systems indices creates hundreds of small indices, while this may have [changed](https://www.elastic.co/blog/three-ways-improved-elasticsearch-scalability) a little, having small indices results in small shards that can lead to some nodes having more disk usage than others.

> [@chethan\_m](#):
>
> 'how do I optimise the disk usage'

On which version you are? On version 8.6 Elastic introduced a new heuristic setting to also consider the [shard size](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-cluster.html#shards-rebalancing-heuristics) while rebalancing, this would help to have a more evenly balanced cluster by not having a node with only big shards and other nodes with only small shards.

For example, consider that you have a 3 nodes cluster and 6 indices with 1 shard each.

- `index1` and `index2` have 20 GB
- `index3` and `index4` have 10 GB
- `index5` and `index6` have 2 GB

On versions before 8.6 Elastic may put `index1` and `index2` on one node, and `index5` and `index6` on another node, so you would have a node with a disk usage of 40 GB an another one with a disk usage of 4 GB, from version 8.6 is expected that this would not happen and the shards would be more balanced.

I'm not on version 8.6 yet, so I can not confirm if this work well or not.

---

<div class="post-metadata">

### Author: ![chethan\_m](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@chethan\_m](https://discuss.elastic.co/u/chethan_m)
#### Post date: [February 20, 2023, 5:18pm UTC](https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544/5 "2023-02-20T17:18:24Z")

</div>

Thanks Leandro for the detailed explanation, with an example. I'm currently on version 7.14.2 and will soon be upgrading to 8.5.2.

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [February 20, 2023, 5:36pm UTC](https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544/6 "2023-02-20T17:36:15Z")

</div>

> [@chethan\_m](#):
>
> I'm currently on version 7.14.2 and will soon be upgrading to 8.5.2.

You will need to upgrade to 7.17 first to check the Upgrade Assistant, then you should upgrade to the last 8 version, 8.6.1 if I'm not wrong.

---

<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, 5:36pm UTC](https://discuss.elastic.co/t/elasticsearch-data-nodes-disk-usage-optimisation/325544/7 "2023-03-20T17:36:31Z")

</div>

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