백업에서 복원 실패

I tried Restore a backup from the command line but i got following:

root@my_server:/var/www/discourse# discourse restore my_server-2023-06-20-033008-v20210922064213.tar.gz
Starting restore: my_server-2023-06-20-033008-v20210922064213.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2023-06-29-113408 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
EXCEPTION: /var/www/discourse/lib/discourse.rb:137:in `exec': Failed to decompress archive.

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
/var/www/discourse/lib/discourse.rb:171:in `execute_command'
/var/www/discourse/lib/discourse.rb:137:in `exec'
/var/www/discourse/lib/discourse.rb:33:in `execute_command'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:78:in `decompress_archive'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:23:in `decompress'
/var/www/discourse/lib/backup_restore/restorer.rb:42:in `run'
script/discourse:149:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
script/discourse:290:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
There was no need to rollback
Cleaning stuff up...
Removing tmp '/var/www/discourse/tmp/restores/default/2023-06-29-113408' directory...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

What should i do now? I really appreciate it if there is any advice.

백업 파일에 문제가 있습니다. 다시 다운로드해 보세요.

일부 상황에서는 백업 파일을 다운로드하는 과정에서 이미 압축이 풀렸을 수 있습니다. 이 경우 gzip으로 다시 압축하는 것이 좋습니다. 예를 들어 다음과 같은 명령을 사용할 수 있습니다.

mv my_server-2023-06-20-033008-v20210922064213.tar.gz my_server-2023-06-20-033008-v20210922064213.tar
gzip my_server-2023-06-20-033008-v20210922064213.tar

하지만 주의하세요: 항상 백업의 안전한 사본을 적어도 두 대의 컴퓨터에 보관해 두세요. 유일한 백업을 잃어버리거나 손상시키면 안 됩니다.

file 명령을 사용하여 파일의 유형을 확인할 수 있습니다:

# file thing
thing: gzip compressed data, last modified: Thu ... 2023, from Unix
# file otherthing
otherthing: POSIX tar archive (GNU)

네, 말씀하신 대로 백업 파일이 잘못된 형식입니다.

네, 맞습니다. .tar 형식의 백업으로 복원하려고 했더니 실패했거든요. 하지만 .tar.gz 형식으로는 성공했습니다!

도와주셔서 정말 감사합니다! 문제는 제가 macOS에서 백업 파일을 다운로드했는데, .tar.gz 형식이 되어야 할 백업 파일이 .tar 형식으로 변환된 것이었어요. 다행히 backup.tar.gz로 포럼을 성공적으로 복구했습니다. :blush: