Decompressing a bzip2 file using another computer

I have a 2 TB file which I compressed using bzip2. This file lives in a Raspberry Pi NAS. How did I compress it? I must have sent it across the network for storage in this NAS; something like this:

rain$ tar cj * | ssh nas dd of=backup.tar.bz2

where rain is my laptop and nas is my Raspberry Pi NAS.

Now, I want to extract that backup file on the NAS itself but using bzip2 is super, super slow on that Raspberry Pi, reaching only a 4 MB/s speed. I noticed that the bottleneck is the Raspberry Pi processor (it is using 100% of a single core only). So, I decided to use another conputer to decompress the bzip2 file using a simple trick:

than$ ssh nas dd if=backup.tar.bz2 | bzip2 -d -c | ssh nas dd of=backup.tar

This effectively downloads the file over a 1Gbps link down to than, decompress it in than on the fly, withour storing it locally (and without waiting for the download to complete) and upload the result back to nas.

than is a desktop PC with an i7 processor. It is uncompressing at 25 MB/s, 6 times faster. This lowers the decompression task from about 1 week to about 1 day.

Of course, I had to set up key authentication on the Raspberry Pi NAS.


Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *