Absolutely best tip for Raspberry Pi

I’m still using a first model of Raspberry Pi. Now, it’s relegated to print server and something more, but it’s really useful and comfortable. For sure, money spent well.

In the whole life of my tiny Raspberry Pi, I understood one big thing: for many reasons, the SD card with the operative system (Raspbian, Pidora or others no matter) of the Raspberry Pi dies a lot of times and more. So, one more time, I remember you one of the most underestimated rule of the IT: backup, backup and backup!

To that with the Raspberry Pi SD card, simple put it in a reader connected to your Linux PC and type this on your terminal:


$ sudo dd bs=4M if=/dev/<your sd address> | gzip > /home/<your username>/<your fav path>/<your file name>-`date +%m%d%y`.gz

This produce a compressed image (gzip) of your SD card, so you can store it on a secure place. European users like me, can use the format `date +%d%m%y`.

You can also check <your sd address> with:


$ sudo fdisk -l

And you can restore the backup to the SD card, with this command:


$ sudo gzip -dc /home/<your username>/<your fav path>/<your file name>.gz | dd bs=4M of=/dev/<your sd address>

This, for me, is the best tip I learned using the Raspberry Pi and saved me a lot of time. I did a backup on a fully configured system (ssh access, print server and something more) and every time the SD card dies, I need only to restore the backup on it. Or to a new card if the old one is fully broken.

One comment

Leave a Reply

Your email address will not be published.