Cloning a Raspberry Pi SD Card to another

To set up my cluster I want to create single SD card image then run this same image on multiple Pi’s. This means I wont need to set up each Raspberry Pi at a time. One of the ways you can do this is by taking an image of the raspberry Pi then flashing that image to many SD cards. Here I detail the process I took to clone the Raspberry Pi image.

This is also an effective way of backing up your Raspberry Pi as you can then restore the full image at a later date if needed.

Writing the Raspberry Pi Image

Before I wrote the image I prepared my Raspberry Pi and installed all required software on it. Once I was happy that I had all the software I wanted I then began the imaging process.

When I put the SD card into my computer it shows as two different drives due to the partitioning. It is important to note the letter of the boot drive. If windows tries to get you to format one of the drives make sure you do not do this. This is because Windows does not understand the filesystem format and formatting it will lose your data.

Two partitions on Raspberry Pi SD Card

To image the SD card I recommend using Win32 Disk Imager.

Part of the reason for the recommendation is that this is the recommended tool to burn Raspbian to a SD card. This meant I already had it installed and had used it before.

Interface used to create a SD card image and write it back to a SD card

Running Win32 Disk Imager allows you to create the image. First you need to pick the location to store it and the device drive to read from. In this case I have selected k:\ drive as this is the boot drive of the Raspberry Pi. The entire SD card will be read so I don’t need to worry that the SD card has two partitions.

Pressing read will clone the SD card to your computer. This gives us the image we can use to clone the SD card.

 

Restoring the Raspberry Pi Image

Once you have the image it is a simple process to write to the new SD card. The same interface above will be used instead to write the image. This time you pick the file to write, the device (which drive letter) and then press write.

This method will only work when cloning SD cards from either the same size or larger than the original. If you clone to a larger SD card then you will need to expand the filesystem later on the Raspberry Pi.

This method can also be used to backup your Raspberry Pi in the event of SD card corruption.

3 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.