# Unable to extract backup from tar.gz archive

**URL:** <https://forums.percona.com/t/unable-to-extract-backup-from-tar-gz-archive/15880>\
**Category:** Percona XtraBackup\
**Tags:** percona\
**Created:** [May 28, 2022, 2:21pm UTC](https://forums.percona.com/t/unable-to-extract-backup-from-tar-gz-archive/15880 "2022-05-28T14:21:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravil\_Khalilov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ravil_khalilov/32/6428_2.png) [@Ravil\_Khalilov](https://forums.percona.com/u/Ravil_Khalilov)\
**Post date:** [May 28, 2022, 2:21pm UTC](https://forums.percona.com/t/unable-to-extract-backup-from-tar-gz-archive/15880/1 "2022-05-28T14:21:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Marcelo\_Altmann](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/marcelo_altmann/32/11299_2.png) [@Marcelo\_Altmann](https://forums.percona.com/u/Marcelo_Altmann)\
**Post date:** [May 30, 2022, 11:16am UTC](https://forums.percona.com/t/unable-to-extract-backup-from-tar-gz-archive/15880/2 "2022-05-30T11:16:36Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![Ravil\_Khalilov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ravil_khalilov/32/6428_2.png) [@Ravil\_Khalilov](https://forums.percona.com/u/Ravil_Khalilov)\
**Post date:** [June 2, 2022, 7:30pm UTC](https://forums.percona.com/t/unable-to-extract-backup-from-tar-gz-archive/15880/3 "2022-06-02T19:30:05Z")

</div>

Hi @Marcelo_Altmann

Thank you for your reply.  
Your solution works.

I replaced compression to xtrabackup’s compression
