< async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"">

Friday, January 24, 2014

Raspberry pi dropbox - manually and automatically backup raspbmc,xbmc,raspberry pi data to dropbox

ADVERTISEMENT
Backup raspberry pi data to dropbox
Backing up data saves a lot of time and efforts. In this post i will show  a simple solution to manually backup the data from raspberry pi to a cloud storage service  drop-box and towards the end of this, i will explain about automatic backup to drop-box using a cronjob.

How it works:

In short it compress the data (in this example, i use .xbmc folder on raspbmc which allows easy restoration of all the xbmc settings in the event of an SD card crash on raspberry pi. This will happen automatically so that you will always have a backup to restore your xbmc. This can extended to any folder on raspberry pi or any other linux distros).

First you need to access the commandline (console) of your raspberry pi. This is done by ssh and you may need to use Putty, if you are on a windows computer.

Then type the following commands: (This will put necessary scripts on your raspberry pi)

wget https://github.com/riyas-org/raspbmcbackup/raw/master/raspbmc_backup.tar.gz

tar -xzvf raspbmc_backup.tar.gz

cd raspbmc_backup/

Now for the first time, you need to set up your drop-box so that it will let the updater script to upload the files in to your dropbox folder

So type /dropbox_uploader.sh  and follow the instructions. Basically it gives a link to dropbox so that you need to authorize it to upload files.

Once set you are done with it, you dont have to repeat it next time and can be scheduled to do the tasks automatically.

So when ever you need to backup your xbmc, just type ./backup.sh (after navigating to this /home/pi/raspbmc_backup folder. To restore an old copy , try ./restore.sh and follow the instructions.

To make the backup process in an automated fashion, we can use crontab (in raspbmc, enable it in the raspbmc settings)

Crash course on crontab:


The format of the crontab file is as follows.

{minute} {hour} {day-of-month} {month} {day-of-week} {path-to-shell-script}

So, to run each sunday at midnight : 0 0 * * 0

crontab -e

Then add the following line to the end of the file

# m h  dom mon dow   command
0 0 * * 0 /home/pi/raspbmc_backup/backup.sh

No comments:

Post a Comment