Privacy Policy
Snippets index

  Clone Raspberry Pi SD Cards Using the Command Line in OS X

Cloning the SD Card With Mac OS X Using the Command Line (CLI)

Locate Your SD Card:

diskutil list

then:

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

Or try this (UNTESTED):

brew install ddrescue

then (UNTESTED):

ddrescue -f ~/raspberrypi.dmg /dev/disk#

Restoring Using the Command Line (CLI)

diskutil list

then:

diskutil unmountDisk /dev/disk#
#sudo newfs_msdos -F 16 /dev/disk#
sudo newfs_msdos -F 32 /dev/disk#
diskutil list

and finally:

sudo dd bs=1m if=~/Desktop/raspberrypi.dmg of=/dev/rdisk#

but set the block size with bs=1M instead of bs=1M if you have GNU coreutils installed.

This will take a few minutes, depending on the image file size. You can check the progress by sending a SIGINFO signal (press Ctrl+T).

Please note that the last command uses the "raw" device /dev/rdisk# instead of the buffered "block-special" device /dev/diskX to obtain a very significant speed increase.

Monitor progress with pipeviewer

brew install pv

then:

dd if=./Desktop/raspberrypi.dmg ibs=4m | pv -s NNNNNN | sudo dd of=/dev/rdisk# obs=4m

where NNNNNN is the file size

result:

1.59GiB 0:02:37 [9.31MiB/s] [==============================================================>                  ] 79% ETA 0:00:40

Expand Filesystem

raspi-config --expand-rootfs

See: https://www.raspberrypi.org/forums/viewtopic.php?t=195836