Backing up and restoring a bootable flash card (e.g for Raspberry Pi) on a separate machine

  • For backup:
    • Insert SD card to be backed up, unmount any automounted partitions, if necessary.
    • for all (2 in case of Raspberry Pi) partitions on the SD card, do: sudo fsck -C /dev/<partition_name>
    • check with sudo cfdisk /dev/<devicename> that you have the right device
    • sudo dd if=/dev/<devicename> of=/home/<username>/backup.dd.img
  • For restore:
    • Insert SD card on which to restore the backup, unmount any automounted partitions, if necessary.
    • check with sudo cfdisk /dev/<devicename> that you have the right device
    • sudo mkdosfs -I -F32 /dev/<devicename>
    • sudo dd if=/home/<username>/backup.dd.img of=/dev/<devicename>
  • via: https://maker.pro/raspberry-pi/tutorial/how-to-back-up-your-raspberry-pi-project-files