1

I'm trying to decompress folder.tar.gz which was previously compressed with zstd, so I did:

unzstd folder.tar.gz.zst

Now if I try to decompress by using:

tar -xvf folder.tar.gz

It will decompress two big files inside some folder joined together.

Apparently the path which was compressed was: /opt/local/data/file1.log and file2.log.

After decompressing I get data folder joined by size of "file1 and file2.log".

user134969
  • 263
  • 2
  • 7
  • Normally you would need option `-z` to extract a `.tar.gz`. Please [edit] your question and copy&paste the output of `tar tvf folder.tar.gz` and `tar tvzf folder.tar.gz`. – Bodo Nov 21 '22 at 14:10

2 Answers2

1

That file is (reading the extensions in order) is a tar file compressed using gzip which itself is compressed by zstd. Eg. double compressed: gzip inside zstd.

This is not common practice, maybe you changed the extension your self or the creator made an error?

The proper extension for a zstd compressed tar file is .tzst...

I would suggest to check the file using the file command

You should also be able to do tar -xvf folder.tzst when it actually is a "zstd compressed tar file" but just has wrong extensions, by just renaming the file...

1

tar.gz.zstd suggests you have a tar archive compressed with gz and the result compressed again with zstd.

To confirm, you can use file:

$ file file.tar.gz.zstd
file.tar.gz.zstd: Zstandard compressed data (v0.8+), Dictionary ID: None
$ unzstd < file.tar.gz.zstd | file -
/dev/stdin: gzip compressed data, from Unix
$ unzstd < file.tar.gz.zstd | gunzip | file -
/dev/stdin: POSIX tar archive (GNU)

To list the contents of the tar archive, you can use libarchive's bsdtar which should be able to detect the double-compression and decompress on the fly:

bsdtar tvf file.tar.gz.zstd

Or with other tar implementation, do it by hand:

unzstd < file.tar.gz.zstd | gunzip | tar tvf -

To extract, it's the same, you just replace t with x.

If you want to remove the redundant compression, you can do:

unzstd file.tar.gz.zstd

And get a file.tar.gz, or do:

unzstd < file.tar.gz.zstd | gunzip | zstd > file.tar.zstd

To get a file.tar.zstd.

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501