# Failed to restore from backup because backup file was renamed

**URL:** https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700
**Category:** Support
**Created:** [07.Декабрь.2018 13:11:19 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700 "2018-12-07T13:11:19Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![SMT](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@SMT](https://meta.discourse.org/u/SMT)
#### Post date: [07.Декабрь.2018 13:11:20 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700/1 "2018-12-07T13:11:20Z")

</div>

Getting the below error when I try to restore data from backup. Pls help.

```plaintext
 Copying archive to tmp directory...
    Unzipping archive, this may take a while...
    tar: meta.json: Not found in archive
    tar: Exiting with failure status due to previous errors
    No metadata file to extract.
    EXCEPTION: Migration version is missing from the filename.
    /var/www/discourse/lib/backup_restore/restorer.rb:226:in `extract_metadata'
    /var/www/discourse/lib/backup_restore/restorer.rb:54:in `run'
    script/discourse:136:in `restore'
    /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    script/discourse:277:in `<top (required)>'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `load'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:28:in `run'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:463:in `exec'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:27:in `dispatch'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:18:in `start'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle:30:in `block in <top (required)>'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
    /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle:22:in `<top (required)>'
    /usr/local/bin/bundle:23:in `load'
    /usr/local/bin/bundle:23:in `<main>'
    Trying to rollback...
    There was no need to rollback
    Cleaning stuff up...
    Removing tmp '/var/www/discourse/tmp/restores/default/2018-12-07-125822' directory...
    Unpausing sidekiq...
    Marking restore as finished...
    Notifying 'system' of the end of the restore...
    Finished!
    [FAILED]
    Restore done.

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [07.Декабрь.2018 13:28:42 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700/2 "2018-12-07T13:28:42Z")

</div>

Did you rename the backup file?

---

<div class="post-metadata">

### Author: ![SMT](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@SMT](https://meta.discourse.org/u/SMT)
#### Post date: [07.Декабрь.2018 14:13:34 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700/3 "2018-12-07T14:13:34Z")

</div>

I’m not sure about renaming. Maybe. Does it affects?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [07.Декабрь.2018 14:23:41 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700/4 "2018-12-07T14:23:41Z")

</div>

Yes, it stops the restore from working. That’s why you’re seeing the following error message.

> EXCEPTION: Migration version is missing from the filename.

Can you rename it back to the original filename?

---

<div class="post-metadata">

### Author: ![SMT](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@SMT](https://meta.discourse.org/u/SMT)
#### Post date: [07.Декабрь.2018 15:56:12 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700/6 "2018-12-07T15:56:12Z")

</div>

> [@gerhard](#):
>
> Can you rename it back to the original filename?

I don’t know the original filename. Also, I don’t have access to old server. I’ve the .gz backup file only.

Any way to find the filename or any other way resolve this??

Thank you.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [07.Декабрь.2018 16:17:58 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700/7 "2018-12-07T16:17:58Z")

</div>

Open the backup file and extract the `dump.sql` file from the `dump.sql.gz`. Open the `dump.sql` file and look for a block of numbers that gets inserted into the `schema_migrations` table.

```plaintext
COPY public.schema_migrations (version) FROM stdin;
20000225050318
20120311163914
20120311164326
...
20181031165343
20181112013117
20181120140552
\.

```

Take the highest number and append it to your backup file. Make sure to prefix the number with `-v`. For example, it might look like this: mybackup- **v20181120140552**.tar.gz

---

<div class="post-metadata">

### Author: ![SMT](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@SMT](https://meta.discourse.org/u/SMT)
#### Post date: [07.Декабрь.2018 17:14:35 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700/8 "2018-12-07T17:14:35Z")

</div>

Thanks a ton man. 🙏 🙏 🙏 🙏

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [06.Январь.2019 17:29:59 UTC](https://meta.discourse.org/t/failed-to-restore-from-backup-because-backup-file-was-renamed/103700/9 "2019-01-06T17:29:59Z")

</div>

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