# After moving a shard related files do not disappear from the disk

**URL:** <https://discuss.elastic.co/t/after-moving-a-shard-related-files-do-not-disappear-from-the-disk/154203>\
**Category:** Elasticsearch\
**Created:** [October 26, 2018, 1:03pm UTC](https://discuss.elastic.co/t/after-moving-a-shard-related-files-do-not-disappear-from-the-disk/154203 "2018-10-26T13:03:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![theistian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theistian/32/36975_2.png) [@theistian](https://discuss.elastic.co/u/theistian)\
**Post date:** [October 26, 2018, 1:03pm UTC](https://discuss.elastic.co/t/after-moving-a-shard-related-files-do-not-disappear-from-the-disk/154203/1 "2018-10-26T13:03:57Z")

</div>

I have a big index with ~16Gb shards. Recently I moved one of these big shards to less disk constrained node. The storage in the new node was reduced the expected size, and the shard was exchanged by a smaller one. But the disk storage from the parting shard never was recovered. Elastic search version is 2.4

Diggin in elastic search directories I found this

```
elasticsearch/clustername/nodes/0/indices/indexname$ du -hcx .
8.0K	./_state
8.0K	./1/_state <--- shard 0 does not live here
119M	./1/translog
15G	./1/index
15G	./1
8.0K	./2/_state
114M	./2/translog                  
16G	./2/index                       
16G	./2
8.0K	./4/_state <--- shard 4 does not live here
13M	./4/translog         
16G	./4/index
16G	./4
8.0K	./3/_state
421M	./3/translog
16G	./3/index
16G	./3
62G	.
62G	total

```

looking to the shards listings:

```
curl -s 'http://localhost:9200/_cat/shards?h=n,i,s,p,sto' | grep the_index | sort
node-01 the_index 1 p 14.7gb 
node-01 the_index 2 p 15.8gb 
node-01 the_index 3 r 15.4gb 
node-02 the_index 0 r 16.2gb 
node-02 the_index 2 r 15.7gb 
node-02 the_index 3 p 13.1gb 
node-02 the_index 4 p 18.1gb 
node-03 the_index 0 p 15.1gb 
node-03 the_index 1 r 14.3gb 
node-03 the_index 4 r 18.2gb 

```

So in node 01 wich is the one I'm looking there is no shard 4 of the index but the files still there.

Is there a way to ask the cluster to do cleanup of these directories ?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [October 26, 2018, 1:32pm UTC](https://discuss.elastic.co/t/after-moving-a-shard-related-files-do-not-disappear-from-the-disk/154203/2 "2018-10-26T13:32:00Z")

</div>

I _ought_ to remove them when it doesn't need them any more. The usual reason for the files to stick around for a while is that you have a scroll open for the shard that hasn't yet timed out. They ought to vanish once the scroll times out. I'm not sure of a good way to see the count of open contexts now that most of the shard has moved off of the node though.

---

<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:** [November 23, 2018, 1:45pm UTC](https://discuss.elastic.co/t/after-moving-a-shard-related-files-do-not-disappear-from-the-disk/154203/3 "2018-11-23T13:45:09Z")

</div>

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