How to save or clone the SD card of a mini PC Raspberry Pi, Orange Pi

carte sd

Saving or cloning the SD card of a Raspberry Pi mini-PC (Orange Pi, Odroid …) is an essential maintenance operation to be carried out regularly. Do not hesitate to clone the SD card before each upgrade or upgrade of the Linux distribution. To make Raspberry Pi so economical, many compromises had to be made. There is no power button and shut down, and storage is entrusted to an SD card usually used for recording photos or video on digital cameras or cameras. An SD card costs almost nothing but it is best to choose it carefully and take care of it. At all, it’s all your hobby work that’s stored on it. Here’s how to make backups from Raspbian, Windows and Mac OS macOS.

Make a backup from Raspbian Jessie

Raspbian Jessie now includes a useful backup utility called SD Card Copier which is found in the Accessories Menu. Use a USB SD card reader to connect the card on which you want to make a clone of backup. The internal drive contains the card (Internal SD Card) on which we start the Raspberry (can’t write on this target by security).

sd-card-copier-raspbian

Restore a backup on Raspbian Jessie

It is possible to restore an old backup. To do this, simply start Raspbian from the copy on the new card present in the USB drive backup map. The Foundation offers however no guarantee on the operation of the procedure on the other distros that NOOBS.

The most well-known (and free) utility on Windows, and Win32 Disk Imager . You can download and install it from the SourceForge site at this address.  After installing Win32DiskImager, insert your SD card into the reader.

win32 disk manager sourceforge

If you do not have the SD Card Reader on your computer (Yes it can happen, or so he is far away behind the computer!), choose a USB adapter .

Click the icon in the form of tree to the right of the entry of the path field. Specify a path and a file name for the backup (it will have the img extension). Finally click on Read to start the backup.

win32diskmanager backup sd card

Restore a backup on Windows

Win32DiskImager will allow us to perform the reverse operation disaster.

Attention. If you have multiple SD cards plugged into your computer, select the right! It is best to remove all other cards to avoid a disaster.

Start show the path of the backup image by opening the file picker. If you don’t have a single card plugged in SD, it is selected automatically. Finally press Write to start the restore.

On macOS, you have to go through the command Terminal. Open the Terminal and insert the card into the SD reader, then run the following command

 diskutil list

All the drives connected to your Mac are listed by this command. It just only to find the path to the SD card. In my case it is/dev/disk3

backup sd card raspbian macOS diskutil list

With the following command, we will create an image of the disc to the format dmg (Mac OS Classic). Don’t forget to replace the path with one that corresponds to your SD card.

sudo dd if=/dev/disk3 of=~/sauvegardeCarteSD.dmg

The operation takes some time (depending on the size of the SD card to save). The SD card image was created at the root of your account under the name sauvegardeCarteSD.dmg.

You can let Time Machine put in a safe place your backup on your Time Capsule now. Before removing the SD card in the reader remember to eject it from the Finder, or using the command

diskutil unmountDisk/dev/disk3

Restore a backup

To restore a backup, we always use the dd command, but this time, we reverse the source and the destination that gives

 sudo dd if=~/sauvegardeCarteSD.dmg of=/dev/disk3

Do not forget to change the path of your file backup and the SD card.

Some tips to avoid disasters

The advantage of using an SD card to operate Raspbian and the very low blow of this storage compared to a typical hard drive or an SSD. For daily use, a SD card is almost as fast as an SSD. After all, the Raspberry Pi is not designed to play. Be that as it may, here are three commands to apply:

Choose a quality SD card

Banish noname SD cards. Don’t hesitate to spend a few extra euros for a card from a manufacturer recognized in (SanDisk, Samsung, Kingston…). choose a card very fast (guarantee of performance of your RPI), at least class 10.

Stop RPI before unplugg the SD card

Never remove the SD Card without having stopped the system (and waited the full stop up to the black screen…). Indeed, the system writes permanently on temporary files, a sudden stop can corrupt the card and make it unusable. Unlike a typical hard drive, it is possible to restore bad sectors.

Under Raspbian, go to Menu then Shutdown . From the Terminal or SSH, run

 sudo poweroff

Similarly if you use the SD card on a different computer, remember to eject (or disconnect) the card before you remove it from the computer.

Make regular backups 

Normally, you should have everything you need to do stress more you with your SD card. If I forgot to mention a solution, comments are there for that.

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

We will be happy to hear your thoughts

Leave a Reply

DIY Projects
%d bloggers like this: