Simplify your Raspberry Pi setup with cloning

Learn how to clone a Raspberry Pi SD card and save time and effort during the setup process. …


Updated September 25, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to clone a Raspberry Pi SD card and save time and effort during the setup process.

When setting up multiple Raspberry Pi devices, it’s often necessary to create an identical copy of the operating system on multiple SD cards. This can be done using the dd command in Linux or MacOS, or third-party tools like Win32 Disk Imager for Windows users. Cloning your SD card allows you to save time and effort during the setup process by eliminating the need to install an OS from scratch each time you set up a new device.

Here’s a step-by-step guide on how to clone your Raspberry Pi SD card using the dd command:

  1. Insert both source (original) and target (empty) SD cards into your computer. You can use a USB adapter if necessary. Make sure you have identified the correct devices before proceeding, as running this command with the wrong device could result in data loss.

  2. Open a terminal window on Linux or MacOS, or open Command Prompt on Windows.

  3. Identify your SD card devices using the following commands:

    • On Linux/MacOS: Run sudo fdisk -l to list all connected storage devices and their sizes. Note down the device names of both source (e.g., /dev/sdb) and target (e.g., /dev/sdc) SD cards.
    • On Windows: Open Disk Management by right-clicking on “This PC” or “Computer” and selecting “Manage”. Locate your SD cards in the list of storage devices and note down their drive letters (e.g., F: for source, G: for target).
  4. Unmount the source SD card to prevent data corruption during cloning:

    • On Linux/MacOS: Run sudo umount /dev/sdb* (replace with your source device name) to unmount all partitions on the source SD card.
    • On Windows: Right-click on the source SD card in Disk Management and select “Safely Remove Drive”. This will unmount it.
  5. Run the dd command to clone the source SD card to the target SD card:

    • On Linux/MacOS: Run sudo dd if=/dev/sdb of=/dev/sdc bs=4M status=progress. Replace /dev/sdb with your source device name and /dev/sdc with your target device name. The bs=4M parameter sets the block size to 4 MB, which can improve performance, especially on slower SD cards or USB adapters.
    • On Windows: Run dd if=\\.\sdb of=\\.\sdc bs=4M status=progress. Replace sdb and sdc with your source and target drive letters respectively. Note that you may need to download a Windows version of the dd command, such as the one available in the GNUWin32 coreutils package.
  6. Wait for the cloning process to complete. This can take several minutes depending on the size of your SD card and the speed of your computer’s SD card reader. You should see a progress report in the terminal window, indicating how many MB have been copied so far and the estimated time remaining.

  7. Once the process is finished, eject both SD cards from your computer and insert them into your Raspberry Pis. The target SD card should now be an exact copy of the source, with all settings intact.

And that’s it! You have successfully cloned your Raspberry Pi SD card, saving time and effort during setup. Keep in mind that this process will create a byte-for-byte copy of the original SD card, including any errors or corrupted files. To ensure a clean copy, consider running a file system check on the source SD card before cloning:

  • On Linux/MacOS: Run sudo e2fsck -f /dev/sdb (replace with your source device name) to check and fix errors on the source SD card.
  • On Windows: You can use a third-party tool like CheckDisk to check and repair file system errors.

Remember, always double-check your device names before running any commands that could potentially wipe data, as making a mistake here can result in data loss!