Raspberry PI SD card backup

Get drives info:

fdisk -l

Create backup:

dd bs=4M if=/dev/sdb | pv | gzip > /home/musuk/raspberry/1.gz
  • /dev/sdb — path for sd card device.
  • dd — tool to read/write stream from device.
  • bs=4M — read buffer size.
  • pv — tool to show read status.

Restore backup:

gzip -dc /home/musuk/raspberry/1.gz | pv | dd bs=4M of=/dev/sdb
  • gzip -dc — decompress parameter.