Megaleecher.Net

Making technology work for you...

Get Your Free Subscription By Email:

How To Take Hot Backup Of Raspberry Pi Without Removing The SD Card

Since we are supposed to do a lot of tweaking and tinkering with our Raspberry Pi installations, it is always a good idea to backup the working SD card image before venturing for any experimentation. One way to do this is to take the whole SD card out and use another Windows/Mac computer to backup and restore the full sd-card image as demonstrated earlier. To save you with this much hassle, here we are with another method to perform automated "hot backups" from a Raspberry Pi itself to an external USB disk drive or remote storage. Simply use the provided Shell script and enjoy fast, efficient and automated RPi backups.

Automated Raspberry Pi Backup Script

Just save the below shared Shell script (use right-click and "save as" this link) on your RPi and execute using sudo ./Raspberry_Pi_Backup_Script.sh. This script disables the "tar" compression command from the original version as it takes "too much" time on our little Pi, to get back that functionality simply uncomment the two relevant lines.

Raspberry Pi Automated Hot Backup Script

Comments

Any chance you could show how to restore a backup made with this?

When I needed a restore it was harder then I thought due to lack of another linux computer, you will need to google for how to restore dd images. This also came very handy for me - http://www.megaleecher.net/Working_With_Linux_Created_DD_Images_On_Windows for getting data back from image on a windows computer.

It seems to work fine.
Thank you so much for the script. It's exactly what I was looking for.

I know this is old now, but thank you SO MUCH! It has saved me lots of time in trying to do one myself :D One thing for anyone running this; Line 67 needs changing as we are no longer compressing the file:

rm -f $DIR/backup_*.tar.gz
rm -f $DIR/backup_*.img

Thank you very much for this script.
On my Raspberry Pi 3 the backup process completes succesfully.

This was just awesome, run and working like a charm on my Raspi 2. Thanks a lot for sharing!!

I tried your backup script and the backup itself runs fine but now I try to restore the image but the image is bigger than the SD card. What do I miss?

Same problem for me

Add new comment

This is just one of the many helpful tips we have posted, You can find more stories here,
Do subscribe to updates using your favorite RSS feed reader or using the secure FeedBurner email update form on top of this post.