# Shards not allocating based on disk space

**URL:** <https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125>\
**Category:** Elasticsearch\
**Created:** [April 16, 2019, 4:36pm UTC](https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125 "2019-04-16T16:36:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peterson](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Peterson](https://discuss.elastic.co/u/Peterson)\
**Post date:** [April 16, 2019, 4:36pm UTC](https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125/1 "2019-04-16T16:36:45Z")

</div>

I have a cluster with 9 nodes, all the same size. The shards are allocating evenly in regards to the number of shards per node, but not in regards to the disk space. In reading the documentation, "Elasticsearch considers the available disk space on a node before deciding whether to allocate new shards to that node or to actively relocate shards away from that node.", but that does not seem to be the case. The nodes range from 31% full to 71% full. I tried using the API to change the rebalancing, but that did not solve anything. Is there a way to allocate the shards based off of disk space (or size of shards) rather than the number of shards? Thank you.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [April 16, 2019, 4:45pm UTC](https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125/2 "2019-04-16T16:45:14Z")

</div>

> [@Peterson](#):
>
> Elasticsearch considers the available disk space on a node before deciding whether to allocate new shards to that node or to actively relocate shards away from that node.

This is from the [page on the disk-based shard allocator](https://www.elastic.co/guide/en/elasticsearch/reference/current/disk-allocator.html) and the rest of the page describes this logic in much more detail. The goal is not to balance the disk usage, it is to keep the disk usage below the configured watermarks.

---

<div class="post-metadata">

**Author:** ![Peterson](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Peterson](https://discuss.elastic.co/u/Peterson)\
**Post date:** [April 16, 2019, 4:46pm UTC](https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125/3 "2019-04-16T16:46:07Z")

</div>

Is there a way to balance disk usage?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [April 16, 2019, 4:49pm UTC](https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125/4 "2019-04-16T16:49:11Z")

</div>

No, not really. I'm not sure I understand why you would want to do this. It would potentially lead to a lot of unnecessary shard movement as the shards grow over time. Can you explain in a bit more detail what problem you're looking to solve with this feature?

---

<div class="post-metadata">

**Author:** ![Peterson](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Peterson](https://discuss.elastic.co/u/Peterson)\
**Post date:** [April 16, 2019, 4:55pm UTC](https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125/5 "2019-04-16T16:55:57Z")

</div>

We often run into the issue where one node goes above the watermark which causes the shards to unallocate and then cannot reallocate. When this happens, we have other nodes that are below the watermark.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [April 16, 2019, 5:20pm UTC](https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125/6 "2019-04-16T17:20:07Z")

</div>

This is surprising to me. Shards are not normally deallocated when a node goes above a watermark. If you exceed the low watermark then nothing happens to existing shards; if you exceed the high watermark then shards are moved elsewhere, but they remain allocated on their current node until the relocation is complete; if you exceed the flood stage watermark then the shards are marked as read-only, but they stay allocated to their current node. I'd like to understand the sequence of events that leads from a full disk to an unassigned shard in more detail. Do you have logs of a case where this happened?

---

<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:** [May 14, 2019, 5:20pm UTC](https://discuss.elastic.co/t/shards-not-allocating-based-on-disk-space/177125/7 "2019-05-14T17:20:07Z")

</div>

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