In the previous post I showed a simple way to backup your Raspberry Pi by making an image of the entire system. However, I forgot to show was, how to restore the backed-up system from that backup image. This post will remedy that oversight.
Ok, here we go, focus. Make some stretches and take couple of deep breaths. You are now ready to insert the SD-card into your reader-device.
First what you need to do, is to locate your SD-card and then your backup image file.
You can locate your SD-card and get additional information like the device path and size using the Disk Utility or directly from the Terminal by running the command bellow in OS X.
If you use Linux, run the following:
If you prefer a more graphical approach, you can see the same information from the Disk Utility. The disk should show as Apple SDXC Reader Media or similar in the left panel. Then point the blue i-icon (info) and you should get a see window like the one below.
What ever approach you take, you should look for the device path, something like /dev/disk1s4. You might have a different device name.
Once you have located both, make sure your SD-card is at least the same size as the image file. You should also have your SD-card emptied and formatted as FAT32 (referred as MS-DOS FAT in OS X Disk Utility).
Again, you can do this from the Terminal or using Disk Utility. The Terminal command would be:
diskutil eraseDisk MS-DOS\ FAT32 RASPIAN MBR /dev/<device name>
In the Dis Utility, select the volume name (usually something like Apple SDXC Reader Media), then the Erase tab. Select MS-DOS (FAT) as the format and give it a name. FAT requires uppercase names.
Finally, you should make sure the SD-card is not mounted but still shows up as a device under /dev -directory.
In Terminal, you just run the following:
diskutil unmountDisk /dev/
In Disk Utility, point the volume name (which should be RASPIAN) and from the contextual menu (aka the right click menu) select Unmount RASPBIAN. The volume will disappear from your Desktop and from /Volumes but is still available in /dev.
Copy the image file to the SD-card
Like in the backup post, we will use the dd command from the Terminal so if you have been using Disk Util or other graphical tools, you will need to fire up that Terminal. Take a breath, it’s not that bad!
The dd command takes (at least) two parameter, if and of. Input file and output file respectively. To copy the image file to the SD-card just run the following:
sudo dd bs=1m if=~/path/to/backup/image.img of=/dev/<device name>
Now, be patient. The dd utility is not verbose, and you won’t see any output in your terminal until it has finished. Depending on the size of the image file, this can take over half an hour.
If all goes well, you should now have fully functional Raspberry Pi again. If you used a larger SD-card than your image was, you might want to start the raspi-config utility from your Raspberry Pi and expand the filesystem to take advantage of all the available space.
Manual pages. Run man diskutil and man dd in Terminal or go to: