Skip to content

Instantly share code, notes, and snippets.

@hapylestat
Last active July 13, 2021 19:41
Show Gist options
  • Save hapylestat/03a87a434c84a8ea9b547d9d502c84cb to your computer and use it in GitHub Desktop.
Save hapylestat/03a87a434c84a8ea9b547d9d502c84cb to your computer and use it in GitHub Desktop.
# Remove sparce space from qcow image
# https://serverfault.com/questions/432119/is-there-any-way-to-shrink-qcow2-image-without-converting-it-raw
qemu-img convert -O qcow2 source.qcow2 shrunk.qcow2
# show progress bar for tar
# https://superuser.com/questions/168749/is-there-a-way-to-see-any-tar-progress-per-file
# note: it requires "pv" package to be installed
_folder=./folder
_target=target.tar.gz
tar cf - ${_folder} -P | pv -s $(du -sb ${_folder} | awk '{print $1}') | gzip > ${_target}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment