0

I am on ubuntu 20.04 and I have a 71GB.tar file that I would like to 7zip before moving it to long-term storage.

I can create a new directory.tar.7z using:

#tar cf - directory | 7z a -si directory.tar.7z

However, I cannot

#7z a -si directory.tar.7z

It just freezes.... no errors...

How can I 7zip pre-existing tar archives?

Time-Bandit
  • 202
  • 2
  • 10

2 Answers2

1

Tell 7z to create a new archive containing the tarball:

7z a directory.tar.7z directory.tar
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
1
#7z a -si directory.tar.7z

It just freezes.... no errors...

It does not freeze, it waits for data on its stdin. -si means "read data from stdin" (and it made sense in case of tar … | 7z a -si …). BTW, how is the command that allegedly freezes supposed to know you want to compress 71GB.tar?

If you want to stick to -si, you can provide the file via stdin:

<71GB.tar 7z a -si directory.tar.7z

but 7z will store it inside the archive as directory.tar. You can specify a name though:

<71GB.tar 7z a -siArbitraryName directory.tar.7z

The easiest thing is not to use -si at all:

7z a directory.tar.7z 71GB.tar
Kamil Maciorowski
  • 19,242
  • 1
  • 50
  • 94