Raspberry Pi backup is what you really need if you work on Raspbian. Believe me, you do! If you иackup your Raspberry Pi SD card in due course, someday it may save your files and your project. Alike any other hardware, the RPi devices may sometimes simply stop working.
It can occur due to a number of reasons: overheating, errors, energy supply issues, cable connection failure… All these problems will make you unplug and plug-in again the device to restart it. And such actions taken repeatedly will certainly lead to spoiling your SD card you are saving your work files to.
On the other hand, you can damage or delete your files occasionally with your own hands! There a lot of examples when we do something wrong because of the overall tiredness, inattentiveness or just being in a hurry.
Also, another reason to backup Raspberry Pi is the simplicity of starting all of the work over. I mean if you are completely messed up while doing some project on your RPi, it takes very short time to delete everything, reinstall the Raspbian and start from the last successful point! This is very simple in case you back up the file system properly.
Finally, you may want to duplicate what you’ve done. In this case, it is very convenient to clone the Raspbian image (which is also a kind of backup) and reuse it again somewhere else.
So, you should do the backup of your Raspberry Pi over the network or literally make your RPi clone to keep your life in harmony!
OK, now I hope you understand the importance of backing up your Raspberry Pi SD card. Below we describe 3 ways to do that.
Step 1: Backup Raspberry Pi SD Card
This way fully depends on your particular goals and wishes. By using SD card backup approach you may either copy the entire image of your file system or choose only to copy selected data to your SD card. If you would like to act the simplest way by storing the separate data or files, simply set up WinSCP client on your Windows PC device, connect to Raspberry Pi via SFTP connection and copy the particular files you need directly from RPi.
On the other hand, creating the whole image of Raspbian may be quite reasonable. It implies cloning the whole file system structure. So, you make a clone of SD card, write the copied image to a new SD card then just plug it in a new RPi and you have a full clone of the original device. If you chose to build this way of a backup, everything will depend on the operating system you are going to use: Linux, Mac or Windows.
It’s quite easy, as you have to fulfill the standard command:
dd if=/dev/sdx of=/path/to/image bs=1M
Note, that “/dev/sdx” should be your SD card
You can use the same “dd” command here, but have to change your SD card designation:
dd if=/dev/rdiskx of=/path/to/image bs=1M
As you’ve already understood, /dev/rdiskx goes for your SD card.
You’ll need a small additional app here, called Win32DiskImager. This app will help you to create the Raspberry Pi image from files kept on your SD card and store it safely on your PC. To make the Raspbian image follow these steps
- Download Win32DiskImager
- Safely remove your SD card from the RPi and insert it into your PC slot
- Open Win32 Disk Imager
- Choose the name and location of the backup file and the letter for your SD card
- Click “Read”
After a short while, the system will create an image of the SD card. Usually, it takes several minutes, depending on the size of the card memory. After that, your Raspbian is fully backed up.
Step 2: CrashPlan for Raspberry Pi Backup
CrashPlan on Raspberry Pi is what I have already written about. Copying files or full image are a manual kind of work. But you definitely need the automatic backup for your Raspberry Pi. CrashPlan is one of the kind. CrashPlan can back up your files to both cloud and your PC or laptop and even on PC of your friend Backup to the cloud is a paid option which includes different pricing plans. Other ones are free. For that, you need a CrashPlan client running on Raspbian.
So, here is where you need ExaGear Desktop. It’ll enable running the x86 CrashPlan app on a Raspberry Pi device. After you get the ExaGear license or at least a demo, follow the instructions below.
As a zero step toy need to download CrashPlan from the official website www.crashplan.com. Note, that you need the Linux version! Then:
1. Unpack ExaGear Desktop archive:
cd home/pi/Downloads tar -xvzpf exagear-desktop-rpi*.tar.gz
2. Install ExaGear:
Start guest x86
3. Enter the guest x86 system using the following command:
Starting the shell in the guest image /opt/exagear/images/debian-8
Check if guest x86 system is on:
There should be the return:
4. Update the guest system:
sudo apt-get update
5. Download libraries necessary for CrashPlan:
sudo apt-get install lxrandr libgtk2.0-0 libXtst6 cpio
6. Unpack the CrashPlan archive, from the default RPi directory (usually, Downloads folder):
cd /home/pi/Downloads tar -xvzpf CrashPlan_4.8.2_Linux.tgz
7. Install CrashPlan on the x86 guest system and from the directory, CrashPlan has been unpacked into:
cd /home/pi/Downloads/crashplan-install sudo ./install.sh
8. Follow the prompts of the installation manager and then configure an auto start:
sudo service crashplan start 2>/dev/null sudo update-rc.d crashplan enable
9. That’s it! Now, you can run CrashPlan with the following command:
Otherwise, you can run CrashPlan from the Start menu.
Step 3: Backup Your Raspberry Pi With Dropbox
Using Dropbox for file system backup on Raspberry Pi is a little bit different approach. It also uses a desktop app to set the process. So what’s the deal? And what’s the main difference from free CrashPlan automatic backup we have looked through earlier?
The main magic of Dropbox on Raspberry Pi is in its data recovery and file versions history access. In fact, Dropbox keeps a history of all versions of the files. With Dropbox, you can restore files for the duration of up to 30 days (120 days for extended business version). Moreover, you can get the access to all those versions online, from any device (even mobile) and from any place 24/7.
So, all you need is to set up Dropbox on Raspberry Pi and use it during your work, storing all the files to Dropbox dedicated folder. Dropbox will do the rest. For any occasion, you’ll be able to restore different versions of files, that’s even better than a pure backup. Worth money and efforts, I guess.
Step 4: Installation Dropbox on Raspberry Pi
The process is very close to what we have done earlier with CrashPlan and you will need ExaGear in this case as well. So, follow these steps:
1. Download and install ExaGear just like in we did it in the previous chapter.
2. Install necessary libraries for Dropbox:
sudo apt-get install wget libxslt-dev libxxf86vm-dev xcb
3. Download Dropbox 32-bit Debian archive:
4. Unpack and launch the installation:
sudo dpkg -i dropbox_2015.10.28_i386.deb; sudo apt-get install -f
5. Run Dropbox.
At the first launch, Dropbox runs the installation daemon. Press “ok” and wait until the installation finishes.
5. You can also set up an autostart for Dropbox:
printf '#!/bin/bash\nexec exagear -- $0 $@\n' > /usr/bin/dropbox
chmod +x /usr/bin/dropbox
Step 5: Other Possibilities for a Raspberry Pi Backup
For example, Backblaze.
If looking through the Backblaze vs CrashPlan difference, the Backblaze offers a little bit more access opportunities as you can get the access to the files stored in the cloud from the mobile devices. But, at the same time, Backblaze includes only Windows or Mac client versions and that is a real obstacle for installing and using it on Raspberry Pi.
Another difference is that Backblaze have a 14-day trial period when you can use the cloud storage account for free and after the expiration date it’ll cost $5/month, while CrashPlan personal “For Home” service option is fully free.
Finally, Backblaze has got a special feature called “B2 cloud”, that can help developers to create the automatic cloud storage and backup via its API with full access both from desktop and mobile devices. It includes first 10Gb of a storage space for free which seems quite an attractive option to make sure if it fits all of your needs.
Another bright backup service provider is Elephant drive .
Basically, it offers similar features, including automatic backup right into the cloud, web access both from desktop and mobile devices, secure sharing. But where the real difference is it is in the Elephant drive pricing plans.
It’s got a free option with 2Gb limited storage space. Concerning the paid ones, there is a choice between “Pro Plan” with $9.95 per month (includes 1,000 GB of storage space) and “Business” featuring $39.95/month (for 2,000 GB). There is a trial period consisting of 30 days of free access to any type of subscription plans. All of these peculiarities make Elephant drive quite interesting and attractive service to consider.
Of course, digging deeper, we can find other opportunities for building up backup for your files on Raspbian. Among them, there are such providers as SOS, Mozy, Livedrive, Acronis and lots of others. All of them look very alike, the only they differ with are their subscription plans, which means that all of them are paid services. If you are looking for the free backup opportunities, additionally to CrashPlan and Dropbox mentioned earlier in this article, you may consider using Google Drive as a cloud storage space.
The original article is Raspberry Pi Backup Guide