Cloning an SD Card for Raspberry Pi

From GlassTTY
Jump to: navigation, search

This article describes the steps necessary to clone an SD card using MacOS or Linux for use in a Raspberry Ri.

Note: This example assumes that /dev/disk2 was the disk identified in each case.

MacOS

Identify the disk

   diskutil list

Copy the disk image to the Mac.

   sudo dd if=/dev/diskX of=~/Desktop/raspberrypi.dmg

Insert new SD card and identify the disk (as above) and unmount the disk.

   diskutil unmountDisk /dev/diskX

Format and copy the disk

   sudo newfs_msdos -F 16 /dev/disk2
   sudo dd if=~/Desktop/raspberrypi.dmg of=/dev/disk2

Linux

Identify the disk

   lsblk

Copy the disk image to the machine, where the disk is /dev/sdk

   dd if=/dev/sdk of=~/raspberrypi.img

Insert new SD card and identify the disk (as above) and un-mount the disk.

   umount /dev/sdk1

Copy the disk

   dd if=~/raspberrypi.img of=/dev/sdk 

Be aware that restoring the disc image to the SD Card can take some time, typically an hour or so.