Skip to content

Instantly share code, notes, and snippets.

@fabienduhamel
Last active February 9, 2018 16:51
Show Gist options
  • Save fabienduhamel/b3ab33b47712df07b1f6b03171031538 to your computer and use it in GitHub Desktop.
Save fabienduhamel/b3ab33b47712df07b1f6b03171031538 to your computer and use it in GitHub Desktop.
Backup and restore a hard drive by gzipping an iso
#!/bin/bash
# Backup
sudo dd if=/dev/sda | gzip > /path/to/backup.iso.gz
# Restore
sudo bash -c "gzip -dc /path/to/backup.iso.gz | dd of=/dev/sda"
@roastercode
Copy link

Does it fit correctly on reboot?
what about boot partition? home? /dev/sda1 /dev/sda3??

@fabienduhamel
Copy link
Author

All partitions are restored.

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