sodcalculator

10 Tech How-To

Clone Raspberry Pi SD Card: Windows, Mac, Linux

Guide 10-28237 · Updated · Step by step

Cloning your Raspberry Pi’s SD card creates an exact backup of the entire system – operating system, settings, installed software, and files – so you can restore it after a failure or duplicate it to another card. This guide covers the full process on Windows, macOS, and Linux using free, built-in or widely available tools. Before you start, shut down the Pi properly, remove the SD card, and make sure your computer has a card reader (built-in or USB). You’ll also need a destination card that is the same size or larger than the source, and enough free space on your computer’s hard drive to store the image file.

What You’ll Need

  • Raspberry Pi SD card (source)
  • Destination SD card (same size or larger)
  • SD card reader (built-in or USB) – or a USB drive if using Linux with a different method
  • Computer running Windows, macOS, or Linux
  • Software: Windows – Win32 Disk Imager or Rufus; macOS – Apple Pi Baker or Terminal (dd); Linux – dd or GNOME Disks
  • Optional: a USB SD card adapter if your computer lacks a slot

Step-by-Step

Windows

  1. Insert the source SD card into your computer’s card reader. Note the drive letter (e.g., E:). If Windows prompts to format the card, cancel – do not format.
  2. Download and install Win32 Disk Imager (free, open-source). Open it as Administrator (right-click → Run as administrator).
  3. In Win32 Disk Imager, click the folder icon next to the “Image File” field, choose a location and filename for the backup (e.g., pi-backup.img), and click Save.
  4. In the “Device” dropdown, select the drive letter that matches your SD card. Double-check it – selecting the wrong drive can overwrite your hard drive.
  5. Click Read to create an image file from the SD card. This reads the entire card, so it may take 10–30 minutes depending on card size and speed.
  6. When finished, remove the source card. Insert the destination card. Ensure it’s the same size or larger.
  7. In Win32 Disk Imager, select the same image file, and in the Device dropdown pick the destination card’s drive letter.
  8. Click Write. Confirm any warnings. Wait for the write to complete – do not unplug during writing.
  9. When done, eject the card safely and insert it into your Pi. It should boot exactly like the original.

macOS

  1. Insert the source SD card. Open Terminal (Finder → Applications → Utilities → Terminal).
  2. Type diskutil list and press Enter. Find your SD card – it’s usually the one with a name like /dev/disk2 or /dev/disk3 and has a small size (e.g., 32 GB). Note the exact disk identifier (e.g., disk2), not the partition (e.g., disk2s1).
  3. Unmount the card with: diskutil unmountDisk /dev/diskX (replace X with your disk number).
  4. Create an image file with: sudo dd if=/dev/rdiskX of=~/Desktop/pi-backup.img bs=4m. Use rdiskX (with the ‘r’) for faster reading. Enter your admin password when prompted. This can take 15–40 minutes.
  5. When done, you’ll see a message like “records in/out”. Eject the card: diskutil eject /dev/diskX.
  6. Insert the destination card. Run diskutil list again to find its disk identifier – it may be different.
  7. Unmount it: diskutil unmountDisk /dev/diskY.
  8. Write the image with: sudo dd if=~/Desktop/pi-backup.img of=/dev/rdiskY bs=4m. This overwrites the entire card – make sure you have the right disk.
  9. Wait for completion, then eject: diskutil eject /dev/diskY. Insert into your Pi and boot.

Linux

  1. Insert the source SD card. Open a terminal. Run lsblk to list block devices. Look for your card – typically sdb or mmcblk0 with a size matching your card (e.g., 32G). Note the device name (e.g., /dev/sdb).
  2. Ensure the card is not mounted. If it is, unmount all partitions with sudo umount /dev/sdb* (replace sdb with your device).
  3. Create an image: sudo dd if=/dev/sdb of=~/pi-backup.img bs=4M status=progress. The status=progress shows progress. Wait for it to finish.
  4. Remove the source card. Insert the destination card. Run lsblk again to find its device name – it may be different (e.g., sdc).
  5. Unmount any mounted partitions: sudo umount /dev/sdc*.
  6. Write the image: sudo dd if=~/pi-backup.img of=/dev/sdc bs=4M status=progress.
  7. Wait for completion. Then sync: sudo sync. Remove the card and boot your Pi.

Common Mistakes

  • Selecting the wrong drive – This is the #1 cause of data loss. Always double-check the device letter (Windows) or disk identifier (macOS/Linux) before reading or writing.
  • Using the wrong disk identifier on macOS – Using diskX instead of rdiskX is slower but safe; using a partition (e.g., disk2s1) instead of the whole disk will fail or write only a partition.
  • Not unmounting the card – On macOS and Linux, writing to a mounted card can cause corruption. Always unmount first.
  • Writing to a smaller card – If the destination card is smaller than the source, the clone will fail or be truncated. Use a card of equal or larger size.
  • Interrupting the process – Unplugging mid-read or mid-write corrupts the image or card. Be patient.
  • Forgetting to sync on Linux – Without sync, data may not be fully written to the card before removal.

Tips

  • Label your cards or images with date and size to avoid confusion.
  • For a smaller backup, use a tool like PiShrink (Linux) to compress the image after creation, but be aware it modifies the image – always keep the original.
  • Use a USB 3.0 card reader for faster speeds.
  • Test the clone immediately by booting the Pi with the new card. If it boots, the clone is good.
  • On Windows, you can also use Rufus to write an image, but Win32 Disk Imager is simpler for this purpose.
  • Consider making a backup before major system changes – it’s cheap insurance.

Troubleshooting

  • Card not detected – Try a different card reader or USB port. On Windows, check Disk Management (right-click Start → Disk Management) to see if the card appears. On macOS/Linux, run diskutil list or lsblk.
  • Write fails with “No space left on device” – Your destination card is smaller than the source. Use a larger card or shrink the partition first.
  • Clone boots but has errors – The source card may have been corrupted. Try re-reading with a different tool or check the card with fsck (Linux) or chkdsk (Windows) on the original.
  • dd on macOS is very slow – Use rdiskX instead of diskX for faster raw access. If still slow, try a different card reader.
  • Windows says “Access denied” – Run Win32 Disk Imager as Administrator. Also, ensure no other program (like Explorer) is using the card.
  • Clone doesn’t boot on Raspberry Pi – The Pi may have a different hardware revision or the card is not seated properly. Try re-seating, or use a different power supply. If the original works, the clone should too – check the card size and speed class.

Frequently Asked Questions

Do I need to shrink the image to fit a smaller card?

Yes, if the destination card is smaller than the source, you must shrink the partition on the source first (using tools like GParted on Linux) before cloning. Otherwise, the clone will not fit.

Can I clone to a larger card and use the extra space?

Yes, but the clone will have the same partition layout as the source. To use the extra space, you’ll need to expand the main partition after booting – on Raspberry Pi OS, run sudo raspi-config and select “Expand Filesystem”.

Is it safe to clone a card that is currently in use?

No. Always shut down the Pi properly and remove the card before cloning. Cloning a mounted card can result in an inconsistent image.

How long does cloning take?

It depends on card size and speed. A 32 GB card typically takes 10–20 minutes on a USB 3.0 reader. Larger or slower cards can take over an hour.

Can I use a microSD to SD adapter for cloning?

Yes, as long as your computer can read the card through the adapter. Just ensure the adapter is not locked (write-protect switch).

What if I accidentally clone to the wrong drive?

Stop immediately. Unplug the drive. Data recovery may be possible with specialized software, but it’s not guaranteed. Always double-check the drive letter before writing.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →