CLONE ODROID,Rapberry PI, Operating system SD CARD ON A MAC

How to Clone Raspberry Pi SD Cards Using the Command Line in OS X

 
by 10 Jan 2014
 
 
 

The Raspberry Pi / Odroid etc runs from an operating system stored on a Secure Digital (SD) card and many different operating systems may be employed. Storage is relatively inexpensive, can be created (flashed), recreated, written to and overwritten with ease.

On the one hand, this is an advantage of the Pi. On the other, the experimental nature of the Pi means more time flashing SD cards. This tutorial shows you how to use a Mac to clone any Raspberry Pi SD card which is particularly useful when you have your OS set up just as you want it.

 

The Raspberry Pi is somewhat different to the computing, to which most of us have been accustomed, of the last two decades. It’s a bare-bones board of components and connectors that requires you to source a power supply, keyboard, monitor and mouse to get it up and running.

With almost two and a half million units sold–in little over a year since its launch–and with its focus on getting kids (adults?) coding and experimenting, it might not be an exaggeration to consider the Raspberry Pi to be a revolutionary device.

Being able to experiment, play and break things is all part of the fun. By cloning your SD cards, you can be up and running again with the minimum of downtime.

Before embarking on cloning your SD card, install NOOBS or the OS of your choice, customise it and get it set up exactly how you like to use it. 

Tip: To set up your SD card, read our tutorials How to Install NOOBS on a Raspberry Pi With a Mac and How to Install NOOBS on a Raspberry Pi With a Mac.

Cloning is the process of making an exact copy. The steps shown, below, will take you through the process of creating a disk image of your existing Raspberry Pi SD card, regardless of the exact operating system you have on it or how it has been set up.

The benefit of having a disk image of your SD card is that you have a backup of your data from which you can easily write a new SD card

Ensure that you have inserted the SD Card, that you wish to clone, into the SD Card reader of your Mac. If your Mac does not have an internal SD Card reader, you will need to plug in an external SD Card reader via a USB socket.

Open Terminal and enter the following command to locate your SD Card:

The response will be something similar to that shown in my screenshot of Terminal. Identify your SD Card (look under NAME and SIZE to verify correct volume). In my example, the SD Card is /dev/disk2.

Locating the SD Card using a Terminal Command
Locating the SD Card using a Terminal Command

Whether your RPi SD Card is all set up as you want it, or you just want to make an incremental clone before installing some software, backing up your SD Card could save you time in the long run.

In my example, my SD Card is /dev/disk2. Amend this as necessary for yours. In Terminal, enter the following command to create a disc image (.dmg) of your SD Card on the Desktop.

Cloning the SD Card with a Terminal command
Cloning the SD Card with a Terminal command

Tip: You may be asked to enter your administrator password in order to proceed with this command. Be aware that no characters will be displayed as you type your password, so be aware of the keys you are pressing and be careful.

The process to clone the SD Card may take some time and you will not be shown any progress, in Terminal, whilst the SD Card is being copied. You will, however, be shown a message when the process is complete. 

The copying process may take some time and will take longer for larger capacity SD Cards. To give you an idea, on my Mac mini Core i5, the process to backup an 8GB SD Card took 23 minutes.

Confirmation of completion
Confirmation of completion

It is useful to create a master image of your SD Card from which you can replicate onto new SD Cards as and when required.

Or it can be used to restore an existing SD Card if it became corrupted or you wanted to revert to a previous state, for example.

Insert a blank (or used and nuked) SD card into the SD card reader on your Mac.

Open Terminal and locate your SD Card, noting that the number may be different to that previously used, using the command:

Locating the SD Card using a Terminal Command
Locating the SD Card using a Terminal Command

In Terminal, enter the following command:

Unmounting the SD Card with a Terminal command
Unmounting the SD Card with a Terminal command

When you have identified your SD Card, enter the following command to format it as FAT16, in my case it’s /dev/disk2. Amend this as required for your circumstances:

Formatting the SD Card from the Terminal
Formatting the SD Card from the Terminal

Locate the disc image, dmg, that you previously cloned. My example assumes that the dmg is on the Desktop. In Terminal, enter the following command ensuring that you identify the correct destination disc, in my example it’s /dev/disk2.

Restoring a disc image to an SD Card
Restoring a disc image to an SD Card

Tip: Be aware that restoring the disc image to the SD Card can take some time. Probably a lot longer than you think. My Mac mini Core i5 took 3 hours 27 minutes to restore on an 8GB SDXC card.

At any time you need to revert to a cloned SD card, don’t be hasty. Instead of swapping out the existing card with the clone, ensure that you re-clone the clone before using it. 

This way, you will always have a version of your OS ready to go, just as you like it and without the need for a lengthy workflow in flashing, installing, upgrading and updating software.

In this tutorial I have shown you how to clone your Raspberry Pi SD Card using nothing more than the command line interface (CLI) in Terminal on OS X. 

Cloning your SD cards can save a lot of time meaning that you can spend more time enjoying and experimenting with your Raspberry Pi.

 
  • ODROID CLONE, CLONE SD CARD, CLONE RASPBERRY PI, CLONE UBUNTU MA, OPERATING SYSTEM BACKUP, OS CLONE, COPY OPERATING SYSTEM, RESTORE TONIDO OPERATING SYSTEM, OS BACKUP, LINUX CLONE, openwrt, LEDE CLONE
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

CLONE RASPBERRY PI SD CARD

Johnny Winter, a regular contributor to Envato Tuts has a simple straight forward way of...

RASPBERRY PI CANNOT SEE WIRELESS NETWORK

Raspberry PI 3 Model b cannot see channel 12 or 13 if router wireless it set to these channels,...

OpenWRT Arduino Radio

https://en.code-bude.net/2013/11/05/radioduinowrt-a-do-it-yourself-webradio/Fantastic project

TONIDO Plug 2 Restoration

https://www.tonido.com/communitywiki/doku.php?id=advanceduses:resetrootfsplug2 How To...