# Rebalancing data between disks

**URL:** <https://discuss.elastic.co/t/rebalancing-data-between-disks/327927>\
**Category:** Elasticsearch\
**Created:** [March 17, 2023, 11:21am UTC](https://discuss.elastic.co/t/rebalancing-data-between-disks/327927 "2023-03-17T11:21:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![INS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ins/32/92827_2.png) [@INS](https://discuss.elastic.co/u/INS)\
**Post date:** [March 17, 2023, 11:21am UTC](https://discuss.elastic.co/t/rebalancing-data-between-disks/327927/1 "2023-03-17T11:21:54Z")

</div>

Hi Can You give some tips how I can trigger rebalance for equal distribution of data depending on the size of the disk

```auto

node shards disk.indices disk.used disk.avail disk.total disk.percent
es_data_hdd_1_2 470 1.8tb 1.8tb 298.5gb 2.1tb 86
es_data_hdd_4_2 510 2.8tb 2.8tb 3.6tb 6.5tb 43
es_data_ssd_5_1 338 2tb 2tb 1.4tb 3.4tb 58
es_data_hdd_4_1 510 2.8tb 2.8tb 3.7tb 6.5tb 43
es_data_hdd_7_2 510 2.5tb 2.5tb 3.9tb 6.5tb 39
es_data_ssd_2_3 338 1.7tb 1.7tb 1.7tb 3.4tb 48
es_data_hdd_3_1 479 1.8tb 1.8tb 294.5gb 2.1tb 86
es_data_ssd_1_3 339 1.8tb 1.8tb 1.6tb 3.4tb 53
es_data_ssd_3_2 339 1.6tb 1.6tb 1.8tb 3.4tb 47
es_data_ssd_1_2 339 1.8tb 1.8tb 1.6tb 3.4tb 52
es_data_ssd_4_2 339 1.9tb 1.9tb 1.4tb 3.4tb 57
es_data_hdd_7_1 510 2.6tb 2.6tb 3.8tb 6.5tb 40
es_data_ssd_2_1 339 1.7tb 1.7tb 1.7tb 3.4tb 50
es_data_ssd_2_2 339 1.5tb 1.5tb 1.9tb 3.4tb 44
es_data_ssd_5_2 338 1.5tb 1.5tb 1.9tb 3.4tb 44
es_data_hdd_1_3 478 1.8tb 1.8tb 308gb 2.1tb 86
es_data_ssd_3_1 339 1.9tb 1.9tb 1.5tb 3.4tb 56
es_data_ssd_4_3 338 2.1tb 2.1tb 1.3tb 3.4tb 62
es_data_ssd_5_3 338 2tb 2tb 1.4tb 3.4tb 58
es_data_hdd_3_2 477 1.8tb 1.8tb 303gb 2.1tb 86
es_data_ssd_3_3 339 1.7tb 1.7tb 1.6tb 3.4tb 51
es_data_hdd_4_3 510 2.6tb 2.6tb 3.8tb 6.5tb 41
es_data_ssd_4_1 339 1.9tb 1.9tb 1.5tb 3.4tb 55
es_data_hdd_2_1 477 1.8tb 1.8tb 325.1gb 2.1tb 85
es_data_hdd_3_3 475 1.8tb 1.8tb 301gb 2.1tb 86
es_data_hdd_1_1 478 1.8tb 1.8tb 302.6gb 2.1tb 86
es_data_hdd_7_3 510 2.7tb 2.7tb 3.7tb 6.5tb 42
es_data_ssd_1_1 339 1.8tb 1.8tb 1.6tb 3.4tb 52
es_data_hdd_2_2 488 1.8tb 1.8tb 327gb 2.1tb 85
es_data_hdd_2_3 476 1.8tb 1.8tb 311gb 2.1tb 86

```

I've already put it below setting but it didn't make a balance on disk

```auto
PUT _cluster/settings
{
  "persistent": {
     "cluster.routing.allocation.enable": "all",
     "cluster.routing.rebalance.enable": "all"
  }
}

```

---

<div class="post-metadata">

**Author:** ![INS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ins/32/92827_2.png) [@INS](https://discuss.elastic.co/u/INS)\
**Post date:** [March 17, 2023, 11:59am UTC](https://discuss.elastic.co/t/rebalancing-data-between-disks/327927/2 "2023-03-17T11:59:48Z")

</div>

For which one value I should change

" `cluster.routing.allocation.balance.disk_usage`  
(float, [Dynamic](https://www.elastic.co/guide/en/elasticsearch/reference/master/settings.html#dynamic-cluster-setting)) Defines the weight factor for balancing shards according to their predicted disk size in bytes. Defaults to `2e-11f`. Raising this value increases the tendency of Elasticsearch to equalize the total disk usage across nodes ahead of the other balancing variables."

---

<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:** [March 17, 2023, 12:08pm UTC](https://discuss.elastic.co/t/rebalancing-data-between-disks/327927/3 "2023-03-17T12:08:18Z")

</div>

Which version are you?

This rebalance based on disk\_usage only works on 8.6+, also it takes into consideration the size of the shards, not the size of the disk.

Also, you have disks from different sizes, I don't think that is possible to have an equal distribution in this situation.

Your `es_data_ssd_*` nodes have disks with all the same size, it looks like that you are using them with the `data_hot` role and you can see that they are already balanced.

But your `es_data_hdd_*` nodes have disks with `2.1 TB` and disks 3 times larger, if they have the same data role it will be not possible to have an equal distribution.

Elasticsearch takes in consideration the number of shards to balance and from 8.6 it also takes in consideration the size of the shard, but the size of the disk will only be taken in consideration when the watermark threshold are hit.

---

<div class="post-metadata">

**Author:** ![INS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ins/32/92827_2.png) [@INS](https://discuss.elastic.co/u/INS)\
**Post date:** [March 17, 2023, 12:13pm UTC](https://discuss.elastic.co/t/rebalancing-data-between-disks/327927/4 "2023-03-17T12:13:49Z")

</div>

> [@leandrojmp](#):
>
> Which version are you?
> 
> This rebalance based on disk\_usage only works on 8.6+, also it takes into consideration the size of the shards, not the size of the disk.
> 
> Also, you have disks from different sizes, I don't think that is possible to have an equal distribution in this situation.
> 
> Your `es_data_ssd_*` nodes have disks with all the same size, it looks like that you are using them with the `data_hot` role and you can see that they are already balanced.
> 
> But your `es_data_hdd_*` nodes have disks with `2.1 TB` and disks 3 times larger, if they have the same data role it will be not possible to have an equal distribution.
> 
> Elasticsearch takes in consideration the number of shards to balance and from 8.6 it also takes in consideration the size of the shard, but the size of the disk will only be taken in consideration when the watermark threshold are hit.

ah ok well I saw in [https://github.com/elastic/elasticsearch/blob/main/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java](https://github.com/elastic/elasticsearch/blob/main/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java)

the this feature was introduced in 8.6 so, I understood when on only one disk hit the watermark this rebalance under disk size should be started. Yes all of hdd disks are used for warm phase, last time I have merged 9 disk into large one -\> 3.

---

<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:** [April 14, 2023, 12:13pm UTC](https://discuss.elastic.co/t/rebalancing-data-between-disks/327927/5 "2023-04-14T12:13:59Z")

</div>

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