Failed to restore from backup because backup file was renamed

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

 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.

Did you rename the backup file?

5 Likes

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

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?

6 Likes

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.

1 Like

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.

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

10 Likes

Thanks a ton man. :pray: :pray: :pray: :pray:

4 Likes

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