How to Clone an SD Card on Mac

Brian Chan
2 min readJan 13, 2025

--

Photo by Praveen Thirumurugan on Unsplash

Recently, I was asked to copy the Raspberry Pi OS from one SD card to others on Mac. So here is the steps, no BS.

Cloning an SD card on your Mac is straightforward if you follow these steps carefully. This process is useful for backing up your Raspberry Pi OS or transferring data between cards. Here’s what you need:

Requirements

  • Two SD cards (source and target)
  • Card reader for your Mac
  • Terminal application

Step-by-Step Guide

1. Insert the Source SD Card

Connect the card reader with the source SD card to your Mac.

2. Identify the SD Card

Open Terminal (Applications > Utilities) and run:

diskutil list

Note the identifier (e.g., `/dev/disk2`).

3. Unmount the Source SD Card

Run:

diskutil unmountDisk /dev/diskN

Replace `diskN` with your disk identifier.

4. Create an Image of the Source SD Card

Run:

sudo dd if=/dev/rdiskN of=~/Desktop/rpi_backup.img bs=1m

Replace `rdiskN` with your identifier. This may take time; an image file will be created on your desktop.

5. Safely Eject the Source SD Card

Run:

diskutil eject /dev/diskN

Replace `diskN` with your source disk identifier.

6. Insert the Target SD Card

Insert the target SD card into the card reader.

7. Identify the Target SD Card

Repeat step 2 to find the identifier of the target card.

8. Unmount the Target SD Card

Run:

diskutil unmountDisk /dev/diskN

Replace `diskN` with the new identifier.

9. Write the Image to the Target SD Card

Run:

sudo dd if=~/Desktop/rpi_backup.img of=/dev/rdiskN bs=1m

Replace `rdiskN` with the target disk identifier. This may also take time, so be patient.

10. Eject the Target SD Card

Run:

diskutil eject /dev/diskN

Final Steps

Remove the target SD card and insert it into your Raspberry Pi. It should boot with the copied Raspberry Pi OS.

Important Notes on Unmounting

  • Purpose of Unmounting
    — Prevent data corruption by stopping the OS from reading/writing during the imaging process.
    — Ensure exclusive access, preventing other processes from using the card.
    — Create a static snapshot of the SD card for accurate imaging.
  • Effect of Unmounting
    — Does not delete content; it simply makes the card inaccessible to the OS.

Using /dev/rdiskN vs. /dev/diskN

  • /dev/rdiskN
    — Raw device access for faster operations; recommended for imaging/cloning SD cards.
  • /dev/diskN
    — Used for working with filesystems, not raw data.

Safely Ejecting SD Cards Without Terminal

To safely eject:

  1. Open Finder.
  2. Locate the SD card.
  3. Right-click and select “Eject” or click the eject icon.
  4. Wait for confirmation before physically removing the card.

By following these steps, you ensure a successful and safe imaging process for your SD cards. That’s all.

--

--

Brian Chan
Brian Chan

Written by Brian Chan

☕ Data Scientist | AI Engineer | Trader . I write post from time to time. Check out my awesome agents 👉 poe.com/brianchanwh

No responses yet