Unable to extract backup from tar.gz archive

Hi,

I made a compressed backup with xtrabackup for my MySQL 5.7 using below command:
xtrabackup --backup --user=root --password= --stream=tar --target-dir=/var/lib/mysql/backup/ | gzip - | split -d --bytes=2GB - /var/lib/mysql/backup/s3-restore.tar.gz

In the output we have 3 backup files:
s3-restore.tar.gz00
s3-restore.tar.gz01
s3-restore.tar.gz02

Extract command that i’ve used:
tar -xvif /home/ubuntu/percona_xtrabackup/s3-restore.tar.gz00 -C .

But, when I try to extract backup from archive I receive an error:
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

Is there any other option to extract archived backups?

P.S.
MySQL version = 5.7
Xtrabackup = 2.7
OS = Ubuntu

2 Likes

Hi @Ravil_Khalilov .

Since you are splitting the file into multiple gzXX ones, you need to pipe them all into tar command. The way you are doing it you are only decrypting the file ending with 00. What you are looking is something like:

cat /home/ubuntu/percona_xtrabackup/s3-restore.tar.gz* |  tar -xvz

Also, why don’t you use the build it compression we have in xtrabackup?

2 Likes

Hi @Marcelo_Altmann

Thank you for your reply.
Your solution works.

I replaced compression to xtrabackup’s compression

1 Like