# Recovering from missing state .si file

**URL:** https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744
**Category:** Elasticsearch
**Created:** [April 25, 2020, 5:48am UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744 "2020-04-25T05:48:00Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![samuel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuel/32/4881_2.png) [@samuel](https://discuss.elastic.co/u/samuel)
#### Post date: [April 25, 2020, 5:48am UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/1 "2020-04-25T05:48:00Z")

</div>

Elasticsearch service has been terminated and fails to restart. The error returned is

```
Job for elasticsearch.service failed because the control process exited with error code.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

```

The log says  
`org.elasticsearch.bootstrap.StartupException: ElasticsearchException[failed to bind service]; nested: CorruptIndexException[Unexpected file read error while reading index. (resource=BufferedChecksumIndexInput(SimpleFSIndexInput(path="/var/lib/elasticsearch/nodes/0/_state/segments_11mz")))]; nested: NoSuchFileException[/var/lib/elasticsearch/nodes/0/_state/_kfz.si];`

I can confirm that the file `/var/lib/elasticsearch/nodes/0/_state/_kfz.si` is indeed missing.

How can I recover Elasticsearch to a state where I can restart it?

---

<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 25, 2020, 6:43am UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/2 "2020-04-25T06:43:51Z")

</div>

Unfortunately that file is essential to Elasticsearch. How did you get it into this state?

Assuming you don't have a copy of this file elsewhere, your best bet is to wipe this node and start again, allowing Elasticsearch to recover any missing shards from the other nodes in the cluster. Alternatively you can restore from a recent snapshot.

---

<div class="post-metadata">

### Author: ![samuel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuel/32/4881_2.png) [@samuel](https://discuss.elastic.co/u/samuel)
#### Post date: [April 25, 2020, 11:24am UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/3 "2020-04-25T11:24:41Z")

</div>

Thanks for the response. I haven't been able to identify the root cause leading to the missing file. Elasticsearch has been running on a server without me doing anything.

The cluster only has one node but I have a snapshot from a few days back. What's the recommended procedure to "wipe this node"? Unistall Elasticsearch, remove /var/lib/elasticsearch, reinstall Elasticsearch and then restore from snapshot? (I'm running Debian and using apt-get to install ES if it matters.)

---

<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 25, 2020, 11:37am UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/4 "2020-04-25T11:37:26Z")

</div>

According to the log message your data path is `/var/lib/elasticsearch`, which means it should be enough to delete the contents of that directory and start Elasticsearch up again. No need to uninstall/reinstall anything AFAIK.

---

<div class="post-metadata">

### Author: ![samuel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuel/32/4881_2.png) [@samuel](https://discuss.elastic.co/u/samuel)
#### Post date: [April 25, 2020, 7:48pm UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/5 "2020-04-25T19:48:15Z")

</div>

Thanks a lot!

After wiping `var/lib/elasticsearch` I had to reset the password for the `elastic` user but I managed.

The next issue is that I either don't know the name of my snapshot or there's still something missing. When I try to run

```auto
curl -XPOST -u elastic localhost:9200/_snapshot/$MY_BACKUP/$MY_SNAPSHOT/_restore

```

with various versions of `$MY_BACKUP` and `$MY_SNAPSHOT` I always get the response `repository_missing_exception`. I can access my snapshot folder but don't know how to fetch the backup and snapshot names.

---

<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 25, 2020, 9:25pm UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/6 "2020-04-25T21:25:54Z")

</div>

Did you [register the repository](https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshots-register-repository.html) again? If not, you'll need to do that. You can list the currently-registered repositories with `GET _snapshot/_all`, and list the snapshots within a repository called `$REPOSITORY_NAME` using `GET /_snapshot/$REPOSITORY_NAME/_all`.

---

<div class="post-metadata">

### Author: ![samuel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuel/32/4881_2.png) [@samuel](https://discuss.elastic.co/u/samuel)
#### Post date: [May 1, 2020, 7:48am UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/7 "2020-05-01T07:48:23Z")

</div>

Thanks again!

I was able to restore a snapshot.

(I also added another node to my cluster and I'm in progress of adding a third one.)

By the way, am I supposed to find documentation of `_snapshot` under [https://www.elastic.co/guide/en/elasticsearch/reference/7.6/rest-apis.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/rest-apis.html)

(I can find [https://www.elastic.co/guide/en/elasticsearch/reference/7.6/snapshot-restore.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/snapshot-restore.html), [https://www.elastic.co/guide/en/elasticsearch/reference/7.6/snapshots-register-repository.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/snapshots-register-repository.html) and [https://www.elastic.co/guide/en/elasticsearch/reference/7.6/snapshots-take-snapshot.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/snapshots-take-snapshot.html) but under the REST APIs I can only fing snapshot _lifecycle management_ documentation...)

---

<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: [May 1, 2020, 8:53am UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/8 "2020-05-01T08:53:12Z")

</div>

That's probably not deliberate, the structure of the reference manual is undergoing some big improvements at the moment so there are some inconsistencies in exactly how and where things are documented. I opened [https://github.com/elastic/elasticsearch/issues/56069](https://github.com/elastic/elasticsearch/issues/56069) in case that omission isn't tracked elsewhere.

---

<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 29, 2020, 8:58am UTC](https://discuss.elastic.co/t/recovering-from-missing-state-si-file/229744/9 "2020-05-29T08:58:46Z")

</div>

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