Raspberry Pi Imaging

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

  1. 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
    
  2. Use the dd command and the gzip 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
    
  3. 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.

  1. Choose a name and location for the image using the folder icon for the Image File field.
  2. Select the device letter of the SD card in the device field the filename
  3. 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.

  1. Click Select Image and select the disk image file to write to the SD card
  2. Click Select Drive if available or Change if the wrong SD card is selected and select the correct one.
  3. Click Flash to start the image writing process

    Etcher 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

  1. 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
    
  2. In order to write to the disk, it needs to first be unmounted.

     sudo diskutil unmountDisk /dev/disk2
    
  3. Unzip the image using gzip and write it to the disk using the dd 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
    
  4. 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.

  1. Choose the image location using the folder icon for the Image File field.
  2. Select the device letter of the SD card in the device field the filename
  3. Press Write