Menu

Recompression Tool

Help
tlhonmey
2010-09-10
2024-08-25
  • tlhonmey

    tlhonmey - 2010-09-10

    When taking an image of a drive, I am usually in a hurry since it is usually a preliminary precaution for a larger process.  Gzip compression provides the best speed-size tradeoff when doing this since all but the slowest machines are primarily limited by disk speeds.

    However, once I have the image, it would be nice to be able to crunch it down into one of the higher compression formats.  Sure, I can expand it out in virtualbox and retake the image, but that's messy and uses a large amount of disk space.  I could also crank the gzip compression up to maximum using advancecomp, but that uses a lot of memory, and doesn't like the image being cut into multiple pieces.

    Is there a tool to recompress the images in place with a different algorithm?  If not I will cheerfully undertake to write one, but I need to know if it would need to change anything other than the "gz" portion of the file name.

     
  • Steven Shiau

    Steven Shiau - 2010-09-19

    No, Clonezilla does not provide such a tool for you. However, it's not difficult to make that by yourself.
    Just remember to keep the naming style of the image file, i.e., for example:
    if the image name of partition is save as "sda1.ext4-ptcl-img.gz.aa" in the image dir, you can gunzip this, and compress it with bzip2 or xz, but the name should be changed to "sda1.ext4-ptcl-img.xz.aa".
    So, for example, if you want to convert it as xz format, with this command, you can make it:
    zcat sda1.ext4-ptcl-img.gz.aa | xz -c > sda1.ext4-ptcl-img.xz.aa

    Steven.

     
  • trfl

    trfl - 2024-08-21

    I have made such a recompressor. It takes any image compression as input, and converts to zstd --long -19

    Run this script inside a folder of images, and it'll recursively recompress all the images it can find. I've added safeguards for everything I could think of;

    • ensure that each image was made by a known-supported clonezilla ver
    • original image is verified against its included checksums (if any)
    • the recompressed image is compared against the original one
    • image is checked with partclone.chkimg after recompression
    • checksum files are updated to include the new files
    • original image is not damaged if this process crashes; work happens inside the subfolder repk of each image
    • skips images which have already been recompressed with the same compression settings

    ...so it should be absolutely safe to use -- and I've had zero issues personally -- but no guarantees of course :-)

    Download: https://ocv.me/dev/clonezilla-repk.sh

     

    Last edit: trfl 2024-08-21
  • Steven Shiau

    Steven Shiau - 2024-08-25

    OK, great. Thanks for sharing that.

    Steven

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.