2

Hi I have an img of a custom linux distro and I would like to convert it to a tar.gz file. (I am using Mac or Linux OS)

What is the most straight forward way to do it?

Thank you

Jibrilat
  • 151
  • 1
  • 1
  • 4
  • You might be better off converting it to a gz file rather then tar.gz as that is easier to work with and you are only talking about a single file. – davidgo Feb 24 '17 at 19:03

1 Answers1

3

Convert isn't quite what it does. You can compress the image into a tar.gz file with:

tar -cvzf linuximage.tar.gz linuximage

You can uncompress/unzip with:

tar -xvzf linuximage.tar.gz

Just replace linuximage with the actual filename or folder.

ProdIssue
  • 367
  • 3
  • 15
  • You might want to prefix this operation by mounting the image, writing a file full of zeros until disk is full (cat /dev/zero>del.me) then deleting said file. This will likely greatly increase the compression ratio because the unused space is all zero rather then unknown characters. – davidgo Feb 24 '17 at 19:06