I have reinstalled my server and before that i did a backed up.

My backup is a tar file without special compress option (meaning that the size of the tar file is approximately the same than the size of the info backed up) and after that, the tar file, is compress with lz4. The backup.tar.lz4 has 350 G and the backup.tar has 1 T

Now i want to restore all the information but my server has only 2 T of capacity then i can't have the tar file and the info at the same time in the server.

How could i decompress the tar file without using an external device like a hard drive. Maybe i could use another server but i would have the same problem of space.

I have thought in using split for separate the 1 T file in files of 300G then decompress one of those files, remove it and go to the next file, but, can i decompress a split file directly or do i need to join them first?


You can use netcat.

Stream the file from a source server with cat and netcat and untar on the destination server using netcat, lz4 and tar. Connect the commands using pipes.

See http://toast.djw.org.uk/tarpipe.html for a similar example.

|improve this answer|||||
  • Mmmm i love the idea so much, i will try for sure!!! – Jaume Garcia Sanchez Jul 31 '19 at 16:35
  • If i understand correctly, from another server ill do cat backup.tar | netcat ip port and from the other server i'll have netcat -l port | tar -xvf. Now my question is: the tar is being "untared" meanwhile is being trasnfered or the file is transfered and then is untared? – Jaume Garcia Sanchez Jul 31 '19 at 16:46
  • I'd suggest to cat the compressed tar, to keep network traffic low and increase untar speed as I assume that decompressing will be faster than network speed, but might depend on the infrastructure & hardware used. The untar happens on the fly, the tared data is not going to hit the disk. Something like netcat -l port | lz4cat | tar -xvC /destination/directory should work. – hargut Jul 31 '19 at 17:18
  • 1
    It worked perfectly thank you so much – Jaume Garcia Sanchez Aug 1 '19 at 9:53
  • Your welcome, I'm glad it worked out. :-) – hargut Aug 1 '19 at 19:00

You won't be able to split a compressed file and then decompress it. Put simply, compression works by identifying and substituting common areas of a file for markers.

I'd think about buying some external storage (USB connected say) to decompress the file onto. Then either untar the file onto the external storage, or untar directly onto your server.

External storage is fairly cheap and you will find the extra capacity useful as you will need to do maintenance, backups etc in the future.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.