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.
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.