loading

It can take a long time to set up a Raspberry PI, then something goes wrong, the card cannot be read or the sucker will not boot and you get to start all over again. Backup ( which implies restore ) is one solution to this.

Backup used to be to tape, the stuff in the picture above. Picture from: https://commons.wikimedia.org/wiki/File:IBM_System...

Step 1: ​Tools and Materials

  • Raspberry Pi
  • PC ( with some tools we will install )

Step 2: ​Overview

The Win32 Disk Imager is a piece of software that is often used to load a OS on a Raspberry Pi. Many people also know that it can be used to read a SD card with an OS. This is the key to backup. However, the image you get is a big as the card. Most of mine are 16 Gig, and this is a fair amount of space, and over my LAN takes a fair amount of time to move around. So zip it. But many zip programs have a size limit smaller than 16 Gigs. Solution use 7-Zip which is fine at 16 Gigs. But how much compression do you get. On my Pi it says about 8 gigs free and this should compress out. In practice the compression went from 15.5 Gig to 3.2 Gig this is saving more than 10 Gigs. Note that 15 Gigs is pretty much all that a Google drive will give you.

Step 3: ​Set Up the PC and Use It

Similar software is probably available for other operating systems, but I will only cover Windows, in my case Windows 7

Install: Win32 Disk Imager beta A tool for writing images to USB sticks or SD/CF

You can read about it use at: INSTALLING OPERATING SYSTEM IMAGES USING WINDOWS

For your backup this reference is as good as any I can write: TNET Raspberry Pi Pages .

This process is not quick, say about 1 hour, 16 gigs is big as SD card speeds.

Then install: 7-Zip is a file archiver with a high compression ratio. http://www.7-zip.org and 7-Zip the image, which again takes about an hour.

I put the image the zipped one, the other may be discarded, in its own directory. Then I add a readme.txt file that summarizes features of the OS, here is a sample:


Backup of Pi operating system -- see date on file
from a 16 gig mini card expanded to use all of card, then 7-zipped

build on os from from D:\_Source\rPi\PiBackups\Checkpoint1\cp1.img

passId
	pi 
	secret_not_really

ip is fixed ... 175

Setup
		autoexec.py, logs on to nas on buff 
                remote desktop xrpd 
		synaptic
		samba
		multiple browsers best? chromnium
		arduino
		lots of python
		runs my terminal and irtools
		spyder
		mysql

Step 4: ​More

It would be nice to shrink the image for some purposes. Try Google. I found this. The Rantings and Ravings of a Madman: Script : Automatic RPi Image Downsizer

Gparted a Linux utility may help in resizing.

I also found that I could mount the card and access it using a virtual box version of Linux Mint. I had to put it in a USB reader not the SD card reader. Then I accessed it with Gparted. This was complicated enough that I did not go farther. Google will help you.

Gparted can also be installed and run on the Pi. Remember it can destroy your disk if you mess up.

Other sites on the web also suggest ways of resizing. In all cases I would have a full size backup and confirm the downsized image before deleting. Comment below on your experiences.

<p>My Raspberry PI backup strategy. No GParted, no additional software ... using an existing Linux PC (or you could use an existing non-Linux Windows PC and boot just about any live-bootable Linux based CD/DVD)</p><p>Put SD/MicroSD card in reader, and discover which /dev/sd(something) it is -- eg /dev/sda is your hard drive, /dev/sdb might be a second hard drive, /dev/sdc is the card reader, and replace X below with that letter ...</p><p>Backup:</p><p>cat /dev/sdX &gt; raspberry-20160109-systemimg-description.img </p><p>8 minutes later, an 8Gb full card image is created into the named file. Too large? Want to shrink that?<br><br>gzip -9 raspberry-20160109-systemimg-description.img </p><p>Compresses it down to remove empty space/redundancy (now called something.img<strong>.gz</strong>)</p><p>Restore:</p><p>gunzip raspberry-20160109-systemimg-description.img.gz &gt; /dev/sdX</p><p>T<strong>his last step has the power to completely ruin your day </strong>if you don't redirect the output to the RIGHT DEVICE (your card reader) :) You can and will blow away your hard drive contents, or at least, 8GB of the start of it if you get that wrong. Just saying, <strong>pay attention</strong>!</p>

About This Instructable

2,320views

25favorites

License:

Bio: For now see me at: http://www.opencircuits.com/User:Russ_hensel
More by russ_hensel:Tic Tak Power Supply Difficult Dis-assembly: Taking Things Apart for Repair A Bit Better Bit Holder 
Add instructable to: