Skip to content

flashimg.sh

M Hightower edited this page Aug 7, 2021 · 5 revisions

If you are looking for a GUI approach, the Raspberry Pi imager app may be a better solution.

sudo apt install rpi-imager

flashimg.sh

This script is a wrapper around Linux dd in an effort to make it easier to use and maybe a little bit safer. It requires that the target drive not have any filesystems mounted and ignores ATA drives. At least it is supposed to.

This bash script can be dangerous. It writes an image file to a block
device. If you are not careful, you can destroy all your data. Exercise
extreme caution!


Usage:

  flashimg.sh
  flashimg.sh rasbian.img [flash device name]
  flashimg.sh --help

  Supported operations:

    flashimg.sh
      Shows a list of Drives. The /dev/sd... device name, size of the device
      (which might be a partition) and the device name description is reported for each. 
      The list is filtered to remove mounted and ATA devices.


    flashimg.sh rasbian.img
      Write file named rasbian.img to flash device '/dev/mmcblk1'


    flashimg.sh [rasbian.img] [flash device name]
      Write a file named 'rasbian.img' to the flash device name specified.


    flashimg.sh --help
      This usage message.

To make customizing easier, the default flash device is defined at the top of the script. Look for flash_dev="/dev/mmcblk1"

Clone this wiki locally