Clone raspberry pi sd card

Clone raspberry pi sd card
Creating a bootable SD memory card for Raspberry Pi or writing an SD memory card with an operating system like Raspbian is one of the more annoying things when working with Raspberry Pi. Depending on which operating system you're working with, Windows, Linux or Mac OS, there are several ways to create an SD memory card with an operating system.

If you have experimented for a while with a Raspberry Pi, you would like to start with a fresh system, or after successful solution of a problem, create a backup, ie an image.

Of course you can do that on a separate computer and simply drag the contents of a memory card as an image file. You can then archive it beautifully and reuse it later.

But when it comes to just duplicating Raspberry Pi SD card. For example, because you want to pass on a configuration for someone else, then creating an image and then writing to another SD card is rather cumbersome. Direct copying between two memory cards would be the solution.
Clone raspberry pi sd card
This requires a USB memory card reader with one SD and one micro SD memory card slot each.

  • Create a script for creating SD card duplicates.
The following solution aims to duplicate an SD memory card using a USB card reader and a Raspberry Pi. For this, the USB card reader must have two ports. One for SD memory cards and one for micro SD memory cards. Usually you will not get two normal and two small ports.

In general, Raspberry Pi can detect any USB memory card reader. If you insert memory cards into the card reader, then these are integrated into the system as drives in the form of sda, sdb, sdc, etc. However, they are not mounted. This is not desirable for the following solution. So if automatic mount is enabled, the drives must be software ejected before duplication.

First, check if any drives are involved:
These drives are identified by the designations "/ dev / sda", "/ dev / sdb" and consecutively, which are additionally marked with a number. As an example we throw out two of these drives.
umount / dev / sda1
umount / dev / sdb1
After the drives have been "unmounted" on the software side, we can continue to create the duplicates.
In this specific application, a USB memory card reader from Hama is available, which can accommodate normal SD cards and even the small micro SD cards. There is one slot each. So a total of two, which in our case, the duplication of an SD card is completely sufficient.

The idea is now to automate the process a bit, so that you do not have to rethink each time when duplicating which commands must be entered. For this we create two files. One for Duplicating SD on Micro SD. And the other for duplicating Micro SD to SD.

To do this, we create the two files, write in the appropriate commands and then make the files executable.
Here you enter:
#! / Bin / bash
sudo dd if = / dev / sdb of = / dev / sda bs = 1MB
exit 0
The file creates a duplicate of the card in the micro SD slot on the card in the normal SD slot.
Save and close: Ctrl + O, Return, Ctrl + X.
Here you enter:
#! / Bin / bash
sudo dd if = / dev / sda of = / dev / sdb bs = 1MB
exit 0

The file creates a duplicate of the card in the normal SD slot on the card in the micro-SD slot.
Save and close: Ctrl + O, Return, Ctrl + X.

Then you have to make both files still executable.
sudo chmod + x
sudo chmod + x

To duplicate an SD card, proceed as follows:

To duplicate from the Micro SD port to the SD port:
To duplicate from the SD port to the micro SD port:
After entering the command line, nothing happens at first. However, you can observe that the activity LED in the USB reader is flashing. That's a good sign.

At some point, when the script is done, it will return to the command line. This can take a while. Depending on how big the memory cards are, the longer it takes. The output then displays an evaluation of how many records were read in and out.

If the number of records is both "on" and "off" the duplication was successful.

In the event of an error, for example, this output comes:
dd: Write "/ dev / sda": There is no space left on the device
7949 + 0 records
7948 + 0 records off
7948206080 bytes (7.9 GB) copied, 1157.9 s, 6.9 MB / s

There was not enough space on the destination memory card. But that does not have to be a real problem. If you tried the created SD card, it will normally work.
Raspberry Pi
November 19, 2017



Popular Posts

USB WiFi adapters that support monitor mode and wireless injection

usb wifi adapter with monitor mode and wireless injection (100% compatibl…

how to update Kali Linux and Fix update error

Kali Linux one of the best Linux distro for penetration testing it's freq…

Fix Kali Linux sources.list Repositories

Fix default repository First after installing a clean Kali Linux the sou…

Recent Comments

Contact Me