Raspberry Pi Imaging
Creating and writing a Raspberry Pi image to and from an SD card
Creating an image from an SD card
Mac and Linux command line
-
Use the following
diskutil
command to display the available disks on the system. This should display a list of disks, labeled as/dev/diskn
. Note: The following examples use/dev/disk2
.diskutil list
-
Use the
dd
command and thegzip
command to create a zip file of the image.Mac
sudo dd if=/dev/disk2 | gzip > ~/path/to/disk/image.img.gz
Note: Mac does not have a status parameter like linux but you can check the progress with
Ctrl+T
Linux
sudo dd bs=4M if=/dev/disk2 status=progress | gzip > ~/path/to/disk/image.img.gz
-
Once the image has finished writting, eject the disk
sudo diskutil eject /dev/disk2
Windows - Win32 Disk Imager
Win32 Disk Imager is the preferred tool for writing an image to an SD card.
- Choose a name and location for the image using the folder icon for the
Image File
field. - Select the device letter of the SD card in the
device
field the filename - Press
Read
Writing an image to an SD card
Balena Etcher - Mac, Linux, and Windows
Balena Etcher is a simple SD card flasher for writing images.
- Click
Select Image
and select the disk image file to write to the SD card - Click
Select Drive
if available orChange
if the wrong SD card is selected and select the correct one. -
Click
Flash
to start the image writing processEtcher defaults to automatically unmounting the drive or SD card after the image been successfully burned and written to the target volume, so keep that in mind if you go looking around in the Finder or elsewhere for a mounted image, it won’t be there. And yes, you can turn that off in Etcher app settings if need be.
Command line - Mac and Linux
-
Use the following
diskutil
command to display the available disks on the system. This should display a list of disks, labeled as/dev/diskn
. Note: The following examples use/dev/disk2
.diskutil list
-
In order to write to the disk, it needs to first be unmounted.
sudo diskutil unmountDisk /dev/disk2
-
Unzip the image using
gzip
and write it to the disk using thedd
command as demonstrated in the following command.Mac
gzip -dc ~/path/to/image/image.img.gz | sudo dd of=/dev/disk2
Note: Mac does not have a status parameter like linux but you can check the progress with
Ctrl+T
Linux
gzip -dc ~/path/to/image/image.img.gz | sudo dd bs=4M of=/dev/disk2 status=progress
-
Once the image has finished writting, eject the disk
sudo diskutil eject /dev/disk2
Win32 Disk Imager - Windows
Win32 Disk Imager is another tool for writing an image to an SD card.
- Choose the image location using the folder icon for the
Image File
field. - Select the device letter of the SD card in the
device
field the filename - Press
Write