Backing up the SD card of the Raspberry Pi is really time consuming. Switch off the Raspberry, remove the card, insert the card into the computer, create an image of the SD card, switch the card back into the Raspberry, switch it on again. Lots of manual work and downtime for the duration of the backup. Reason enough to do it all remotely via terminal session. These are the instructions for creating and restoring the backup. Works for backups of SD cards on any Linux system.

 

 

 

 

Create Backup

 

Open the terminal session and fire the following line, adjusting the red parts (IP address of the raspberry and file name of the backup):

 

ssh pi@192.168.10.11 “sudo dd if=/dev/mmcblk0 bs=1M | gzip -” | dd of=~/Desktop/backup_2017-11-14.gz

 

The system then asks for the given password for the user “pi”. Enter the password and then WAIT FOR A LONG TIME, even if the system does not display any updates during the process.

 

Fun Fact: If you are on the Mac, you can check the current status of your backup with “CTRL”+”T”. You can press the combination infinitely often during the transfer to display the transferred bytes.

 

When the backup is complete, your input line will reappear in the terminal.

 

For best performance I recommend this SD-card: http://amzn.to/2BDuGyX (Affiliate-Link)
Further on I recommend this Raspberry Pi Starter Set: http://amzn.to/2BERjDw (Affiliate-Link)

 

Restore Backup

Recovery does not work remotely. After all, the system would be flattened at runtime. It would be exactly like cutting the famous branch you are sitting on. If that was possible, it would be an security risk. Here you really have to grab the card and create the SD card from the backup on an external system.

 

Open the terminal session and fire the following line, adjusting the red parts (target disk {SD card} and file name of the backup):

 

diskutil unmountDisk /dev/disk1
gzip -dc ~/Desktop/backup_2017-11-14.gz | sudo dd of=/dev/rdisk1 bs=1m conv=noerror,sync

 

 

All the links in this text are Amazon Affiliate Links, and by clicking on an affiliate link I will earn a percentage of your subsequent Amazon purchases. However, this circumstance does not influence the background of my product recommendation. This product recommendation is independent, honest and sincere. 

Bei allen genannten Links in der Videobeschreibung handelt es sich um Amazon-Affiliate-Links.Durch einen Klick auf einen Affiliate-Link werde ich prozentual an Euren darauf folgenden Amazon-Einkäufen beteiligt. Dieser Umstand beeinflusst aber nicht die Hintergründe meiner Produktempfehlung. Diese Produktempfehlung erfolgt unabhängig, ehrlich und aufrichtig.