备份还原失败,原因在于 .tar 与 .tar.gz 文件扩展名不一致

Hi can you please let me know what might be the issue, restoring the backup.
Backup was created on 2019-09-03

Any tips would be highly appreciated :heart:

> root@discourse-beta-ubuntu-s-1vcpu-1gb-sgp1-01-app:/var/www/discourse# discourse restore entc-bme-forum-2019-09-03-194746-v20190603134013.tar.gz
> Starting restore: entc-bme-forum-2019-09-03-194746-v20190603134013.tar.gz
> [STARTED]
> 'system' has started the restore!
> Marking restore as running...
> Making sure /var/www/discourse/tmp/restores/default/2020-03-28-174121 exists...
> Copying archive to tmp directory...
> Unzipping archive, this may take a while...
> EXCEPTION: File exists - /shared/tmp/restores/default/2020-03-28-174121/PaxHeader
> /usr/local/lib/ruby/2.6.0/fileutils.rb:525:in `block in mv'
> /usr/local/lib/ruby/2.6.0/fileutils.rb:1557:in `block in fu_each_src_dest'
> /usr/local/lib/ruby/2.6.0/fileutils.rb:1566:in `block in fu_each_src_dest0'
> /usr/local/lib/ruby/2.6.0/fileutils.rb:1564:in `each'
> /usr/local/lib/ruby/2.6.0/fileutils.rb:1564:in `fu_each_src_dest0'
> /usr/local/lib/ruby/2.6.0/fileutils.rb:1555:in `fu_each_src_dest'
> /usr/local/lib/ruby/2.6.0/fileutils.rb:520:in `mv'
> /var/www/discourse/lib/compression/strategy.rb:41:in `strip_directory'
> /var/www/discourse/lib/backup_restore/backup_file_handler.rb:70:in `decompress_archive'
> /var/www/discourse/lib/backup_restore/backup_file_handler.rb:22:in `decompress'
> /var/www/discourse/lib/backup_restore/restorer.rb:42:in `run'
> script/discourse:143:in `restore'
> /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
> /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
> /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
> /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
> script/discourse:284:in `<top (required)>'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
> /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:34: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/2020-03-28-174121' directory...
> Unpausing sidekiq...
> Marking restore as finished...
> Notifying 'system' of the end of the restore...
> Finished!
> [FAILED]
> Restore done.
1 个赞

First there was an issue the archive being a .tar file, but i recompressed to .tar.gz

4 个赞

Why did you need to make changes to the backup file created by Discourse? Did you create manually create the tar file (on MacOS)? I’ve seen reports where it uses a different tar format which causes problems during decompression.

You might need to create a new tar file with the --format ustar option or, even better, create a new backup directly in a Discourse Docker container.

1 个赞

i downloaded the backup from my previous hosted discourse months back… when I located it, it was having the .tar extension (i have no clue why - I saw my emails had .tar.gz)

I will try your suggestion!
Thanks a lot @gerhard!

I’m facing the same issue and tried this. The file uploads fine, but restoration can’t find the DB dump:

[2025-01-23 18:39:45] EXCEPTION: No such file or directory @ rb_check_realpath_internal - /var/www/discourse/tmp/restores/default/2025-01-23-183945/dump.sql.gz

Any suggestions? Thanks

1 个赞

Hey Martim,

I see your new topic Locked out of my forum after restore, does that mean you were able to navigate this specific issue succesfully?

It does! Sorry, I thought I had deleted my comment as I managed to restore shortly after.

1 个赞