I'm taking a dd
of a drive and trying to share it with a friend. It's rather big after dd
(~8gb). When I tar -czvf my-image.img
I can get it down to ~1.5gb. However, if I try to test unzip it, I see that the shasum
hash of the unzipped file is different from the file I had originally before zip. Is there a way I can "lossless" zip a file?
1 Answer
As others have stated zip (and gzip & which is what you are actually using) are lossless. If the 2 files are not identical its because of corruption that should not be occurring or, more likely you gave implemented the command wrong.
The way you are attempting this is sub-optimal, the command you are looking for should be
tar -czvf my-image.tar.gz my-image.img
And to decompress
tar -zxf my-image.tar.gz
Of-course, the command you are using is designed to work to package and compress multiple files. As you only have a single file you dont need to use tar at all, you should just use gzip -
gzip my-image.img
and to decompress
gunzip my-image.img.gz
tar -czvf my-image.img
and it's not even a complete command that would work.