Recompress clonezilla images from gzip to bzip2

You can adapt this for any compression scheme but I sometimes make backups of systems that lack processing power to justify compressing backups to bz2 on the fly. My solution is to do gz first and recompress the images later on another machine, still keeping them compatible but reducing them in size. Restoring works as if you would have used bz2 from the start.

cat sda1.ntfs-ptcl-img.gz.* | gunzip \
| pbzip2 -c | split -b 4096m - sda1.ntfs-ptcl-img.bz2.

or if you want prettier progress display using pv

cat sda1.ntfs-ptcl-img.gz.* \
| pv -c -N "gz " -s \
$(du -sbc sda1.ntfs-ptcl-img.gz.* | tail -n -1 | awk '{print $1}') \
| gunzip | pv -c -N "raw" \
| pbzip2 -c | pv -c -N "bz2" \
| split -b 4096m - sda1.ntfs-ptcl-img.bz2.

There’s room for improvement and scripting but I think you get the geist of it.

Leave a Reply

Your email address will not be published. Required fields are marked *