Skip to content

Instantly share code, notes, and snippets.

@Stefan-Code
Last active September 21, 2016 16:28
Show Gist options
  • Save Stefan-Code/ef6b379d604a21ff0e24bf2179a77239 to your computer and use it in GitHub Desktop.
Save Stefan-Code/ef6b379d604a21ff0e24bf2179a77239 to your computer and use it in GitHub Desktop.
Hard Drive snapshot command

The following command creates a complete compressed disk snapshot of /dev/sda. Replace 500107862016 with the size of the media to be backed up so pv shows progress information. Runs at a speed of about 30MB/s for me. When using pigz instead of gzip for compression I can achieve speeds of around ~150MB/s (using SSDs).

dd if=/dev/sda conv=sync,noerror bs=64M | pv -s 500107862016 -pera | pigz -c > /media/user/backup.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment