Skip to content

Instantly share code, notes, and snippets.

@mboyar
Last active August 13, 2020 13:38
Show Gist options
  • Save mboyar/cf83870c07eeeb2cd42402f0e1b3cb68 to your computer and use it in GitHub Desktop.
Save mboyar/cf83870c07eeeb2cd42402f0e1b3cb68 to your computer and use it in GitHub Desktop.
~~~
#Backup
$ sudo dd if=/dev/sdX | gzip -c > /path/to/backup.img.gz &
$ while((1)); do sudo kill -SIGUSR1 $(pidof dd); sleep 1; if [[ $(pidof dd) == "" ]]; then break; fi; done
~~~
#Restore
$ gunzip -c /path/to/backup.img.gz | dd of=/dev/sdY
$ while((1)); do sudo kill -SIGUSR1 $(pidof dd); sleep 1; if [[ $(pidof dd) == "" ]]; then break; fi; done
~~~
#See https://wiki.archlinux.org/index.php/Dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment