The flashing of filesystem images for RaspberryPi and other embedded Linux platforms can take several minutes using the dd command. To speed up these image transfers, a helpful package called bmap-tools can be used. This package is available in most Linux distributions.

The bmaptool command in this package can be used to create a block-map for the image to be copied, and efficiently copy the image to the target destination.

There are two sub-commands of bmaptool:

  • bmaptool create – for creating a block-map for an image
  • bmaptool copy – for using the created block-map to efficiently copying the image to the target destination

For example, we would generate the block-map for an image and transfer the image to our RaspberryPi’s SD card as follows:

> bmaptool create myimage.sdimg > myimage.sdimg.bmap
> bmaptool copy -bmap myimage.sdimg.bmap myimage.sdimg /dev/sdc
bmaptool: info: block map format version 2.0
bmaptool: info: 645120 blocks of size 4096 (2.5 GiB), mapped 132651 blocks (518.2 MiB or 20.6%)
bmaptool: info: copying image 'myimage.sdimg' to block device '/dev/sdc' using bmap file 'myimage.sdimg.bmap'
bmaptool: info: 100% copied
bmaptool: info: synchronizing '/dev/sdc'
bmaptool: info: copying time: 1m 25.6s, copying speed 6.1 MiB/sec

Where:

  • myimage.sdimg.bmap is the created blockmap for our image.
  • /dev/sdc is our target SD card.