< BACK
Bash tips, tricks and code snippets
Making a compressed disk image using dd and pv to indicate progress
See this reference.
Prerequisites
The program pv
needs to be installed, if not:
sudo apt install pv
Process
Given the device point /media/sdc
, the following creates image file SD_BACKUP.img.gz
:
export BLOCKSIZE=`sudo blockdev --getsize64 /dev/sdc` && sudo dd if=/dev/sdc bs=1MB | pv -s $BLOCKSIZE | gzip -9 > SD_BACKUP.img.gz