DISCOVER
X

Raspberry Pi: Make Sure You Backup Your SDCard

April 16, 2013 7:23 am 3 Comments
FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail

So, this is a short post to remind everyone using Raspberry Pi. Friends, if you have a great setup on your SD card, don’t forget to back it up. While writing for my upcoming article on the weekend, my Raspberry Pi SD Card encountered some pretty bad errors, most likely in the boot sector. Basically it says “Kernel Panic: VFS: Unable to mount root fs…”.

What happen, I think, I transferred too many files using too many concurrent connections to the Raspberry Pi via SFTP. This killed the Raspberry Pi completely, the UI was unresponsive and my desktop lost connections to it. The little Raspberry Pi was frozen. So I turned it off and re-boot it, well that’s when I see the error. I then did some research and there were some forum posts about fixing it using fsck, however I didn’t attempt it. Since I didn’t have that much data on it and most of my experiment has been documented on the posts in this website such as dosbox, retro console and luakit; I just decided to re-flash the card.

However, for the future, after I setup the Pi as it used to be this is what I do:

Dump the SDCard Image

I think this is the best thing with Raspberry Pi, it uses SDCard. I can just dump the image onto my harddrive using the DD command. So basically I looked at what my SDCard device is using diskutil.

I’m doing this using my OSX laptop, but it’s easy enough to do this with any Linux machine.

You’ll see something like this:

It’s pretty easy to identify that the SDCard is the /dev/disk3 as it’s only 8 GB.

So the next thing to do is unmount the SDCard using the Disk Utility or similar tool.

Then the dump the SDCard using DD

The of parameter can be any filename that you want to use and the if parameter is the device that your SDCard resides on.

Please note that doing an image dump would create the exact same full size of your SDCard, so in this case the SDCard is 8 GB.

I think this is the simplest way of doing backup as to restore back all you have to do is do another DD to fill in the SDCard.

Backing Up the Data via SFTP

This is definitely a good simple way to backup your data of your Raspberry Pi. I don’t think this will be useful to backup the actual disk structure, but for data, this is the simpler way. Simply use any SFTP program like Filezilla or WinSCP and login to your Raspberry Pi using your usual login. Then download all the data that you wanted to backup.

Rsync via SSH

Another way to do automated data backup can be using Rsync via SSH. If you have another linux box you can simply run a cron job to rsync your data periodically from the raspberry pi into your linux box. I won’t go into details on this, perhaps for another day.

I’m sure there are other good ways of backing up your data, if you have any suggestions feel free to leave a comment and share it with everyone :)

FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail

Categorised in: , ,